Nullable with reference types

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 1 01:54:51 PDT 2015


On Tuesday, June 30, 2015 14:29:52 Steven Schveighoffer via Digitalmars-d-learn wrote:
> I know this is just back-of-envelope, but what's wrong with:
>
> alias Nullable(T) if(is(T == class)) = T;
>
> bool isNull(T)(T t) if(is(T == class)) { return t is null;}

In principle, there's no reason why we can'd do something like that. It's
essentially what we do with the take and its return type (though that
doesn't require a free function for additional functionality). The question
would be whether it would break code to do so and whether it would be worth
the breakage if we did.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list