Improvements to std.typecons.Nullable

BLM768 blm768 at gmail.com
Tue Oct 8 18:35:59 PDT 2013


On Tuesday, 8 October 2013 at 20:55:35 UTC, monarch_dodra wrote:
>
> Or we could just nuke the alias this. A Nullable!T isn't a T. 
> It's a T handler. "alias this" allows implicit cast, which 
> should only happen with a "is a" relation. Using it in a 
> different context (such as nullable) is wrong, and these errors 
> are the price we are paying for it. It's a bit more verbose, 
> but it would solve *all* of these ambiguity and unexpected 
> error problems.

Maybe...

An object reference can be null, but a null "Object" isn't really 
an Object but the absence of one. With "alias this", the behavior 
meshes with the behavior of object references. Whether that's 
good or bad, it does add some consistency.

I'm not sure what I'd like to see in the long term, but I'll 
leave the "alias this" in for my pull request because removing it 
would be a breaking change.



More information about the Digitalmars-d mailing list