Improvements to std.typecons.Nullable

BLM768 blm768 at gmail.com
Tue Oct 8 12:04:32 PDT 2013


I've been working on a project that makes relatively heavy use of 
nullable values. I've been using std.typecons.Nullable, and it 
mostly works well, but there are some improvements that could be 
made to the implementation:

* A toString() method (needed to fix bug #10915)
* An opEquals for comparisons with the type that the Nullable 
wraps
   * Currently, comparing a null Nullable!T with a T produces an 
error,
     but it makes more sense to just return false.
* Making isNull() @property

get() might also make more sense as a property, but not with its 
current name; it would be better to make the name a noun such as 
"value" rather than a verb. If it were to be changed, it could be 
done in a fully backward-compatible way by making "get" an alias 
of "value".

These would all be simple changes, so if someone's willing to 
guide me through the formalities, I could make this my first 
contribution to Phobos.


More information about the Digitalmars-d mailing list