Nullable!T

Adam Ruppe destructionator at gmail.com
Wed Jul 7 08:06:17 PDT 2010


On 7/7/10, Clemens <eriatarka84 at gmail.com> wrote:
> That brings up an interesting corner case though: once uniform call syntax
> is supported for pointers and references, and you have a null reference x,
> an actual method x.foo() would give you a segmentation fault, while a
> pseudomethod that is implemented as a free function could have the same call
> syntax, x.foo(), but could potentially work even for null references.
> Correct?

Yes, that would work. It is necessary that it does for a nullable api
too, since hasValue should be a call, which is the same as !is null;
it needs to be able to return false if it is null, not segfault.

(Ideally, I'd just like to get the "x is null" to work somehow, but
however it looks, it does need to work.)


More information about the Digitalmars-d mailing list