Improvements to std.typecons.Nullable

Brad Anderson eco at gnuk.net
Tue Oct 8 12:20:04 PDT 2013


On Tuesday, 8 October 2013 at 19:04:33 UTC, BLM768 wrote:
> 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.

The wiki has a pretty good guide of the overall process: 
http://wiki.dlang.org/Pull_Requests


More information about the Digitalmars-d mailing list