A typed pointer to a variant of Types, packed into a word (size_t).
A variant of Types packed into a word (size_t).
http://forum.dlang.org/post/sybuoliqhhefcovxjfjv@forum.dlang.org
TODO Ask forum.dlang.org: Is it safe to assume that typeBits most significant bits of a pointer are zero? If not put them in least significant part.
TODO What todo with the fact that the GC will fail to scan WordVariant? Can the GC be tweaked to mask out the type bits before scanning?
TODO Enable support for is null instead of isNull?
TODO Use enforce() instead of assert() in WordVariant:initialize()
TODO Move to Phobos std.variant
Lightweight versions of polymorphism packed inside one single word/pointer.
Most significant bits are used to store type information.
These higher bits are normally unused on 64-bit systems (tested on Linux). 16 higher bits are, on Linux, either 1 (kernel-space) or 0 (user-space).