www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - C# implementation of Nullable (May)

reply "Jesse Phillips" <Jessekphillips+D gmail.com> writes:
This article goes over a Nullable/Optional/Maybe implementation 


http://twistedoakstudios.com/blog/Post1130_when-null-is-not-enough-an-option-type-for-c

http://www.reddit.com/r/programming/comments/14930f/when_null_is_not_enough_an_option_type_for_c/

It seems to be similar to that of std.typecons.Nullable with the 
following differences.

The only way to get at the value is to call the Match function, 
this takes a delegate to handle the value and one to handle the 
absence of the value.

Most everything else is handled as helper functions residing 
outside the type.

The get() method is implemented as helper ForceGetValue.

He also creates an Else function to provided the value or an 
alternative if not available.

Sorry if bearophile already got to this one and I missed that.
Dec 04 2012
next sibling parent "bearophile" <bearophileHUGS lycos.com> writes:
Jesse Phillips:

 It seems to be similar to that of std.typecons.Nullable with 
 the following differences.
Recently I've written something about Nullable: http://d.puremagic.com/issues/show_bug.cgi?id=9086 Bye, bearophile
Dec 06 2012
prev sibling parent "Michael" <pr m1xa.com> writes:
On Wednesday, 5 December 2012 at 00:10:30 UTC, Jesse Phillips 
wrote:
 This article goes over a Nullable/Optional/Maybe implementation 


 http://twistedoakstudios.com/blog/Post1130_when-null-is-not-enough-an-option-type-for-c

 http://www.reddit.com/r/programming/comments/14930f/when_null_is_not_enough_an_option_type_for_c/
Also http://devtalk.net/csharp/chained-null-checks-and-the-maybe-monad/
Dec 06 2012