For one reason, variants take 16 bytes of memory! 2 bytes are a word consisting of the type, never mind that there are only 16 types in a variant, followed by 6 unused bytes, followed by the 8 bytes for the pointer or basic type. If I were to do something similar it would literally be a 3 byte variation of variants.

But then another problem arises: type conversion. Delphi only permits conversion (inline) for a type/object of to and from 1 type for each implicit and explicit typecasts. Adding more types doesn't work.

This might be a better idea in the long run, but it seems circuitous. Surely someone has had use for something similar! Delphi auto-magically controls variants and their lifetimes, but writing something similar yet compact will require a good bit of effort on my part.

And what I will be using this for will use quite a few variants in dynamic (de)allocation in function calls. To do this could slow things down a bit. Maybe it is better to pass strings explicitly and force conversion of the parameters in the various functions?

What do you guys think?