Arguments (and friends): Use more (smart) C++ templates to replace typed-operations
In various code paths we repeat the same thing for different structures or types, while in some cases the problem has been resolved using C-style macros, in modern C++ world we can achieve this in a better way with proper static checking and type-safety (and with some smarter selections done using the SFINAE technique).
So... Rewrite some parts in order to avoid mistakes and inconsistencies, in particular:
- Adding inline functions to access to
GIArgument's members in a consistent way, using the wanted type and/or the
GITypeTagto select them consistently
- This may also open the road to do a proper wrapper for it, but it was too much for now.
- Created a standard way to convert JS values to C values with type-checks so that we safely use the right container type to store values and, if needed, with out-of-bounding checks.
- As per this, using only template functions to convert primitive values or array of values.
- Replaced all the main
#define(non in header) macros around to repeat the same operations using inline functions instead with proper code checks.
- Various cleanups and some more C++izations.
Last, but not least, this should also implementing new types as per
BigInt, making !412 work hopefully easier.