NULL indicator in Variant

Robert Jacques sandford at jhu.edu
Thu Oct 27 08:17:51 PDT 2011


On Thu, 27 Oct 2011 09:12:26 -0400, Steve Teale <steve.teale at britseyeview.com> wrote:

> How big a deal would it be to add a NULL indicator to the VariantN struct.
>
> I use the term NULL as opposed to null deliberately. Variant already
> provides the hasValue() method, which can serve as a null indicator. But
> in using it as a parameter in database modules, it would be useful to be
> able to give a Variant instance a type, as in v = "", but also to set it
> explicitly as NULL with setNull() or whatever.
>
> Could this fly without breaking existing code?
>
> Steve
>

Any reason making a custom NULL type wouldn't work? i.e:

struct NULL {}

Variant var = NULL;

assert(var.type == typeof(NULL));


More information about the Digitalmars-d mailing list