Optional<T> equivalent in D?

Michael pr at m1xa.com
Sat Nov 16 00:15:58 PST 2013


On Friday, 15 November 2013 at 22:39:40 UTC, Jacek Furmankiewicz 
wrote:
> Many other languages are starting to frown on returning null 
> values from methods (due to NullPointerException risks, etc) 
> and wrapping them instead in an Optional<T> like in
>
> Scala:
> http://blog.danielwellman.com/2008/03/using-scalas-op.html
>
> Google Guava for Java: (now rolled into the base JDK for Java 
> 8):
> https://code.google.com/p/guava-libraries/wiki/UsingAndAvoidingNullExplained
>
> Is there a similar approach in D? Or maybe an equivalent is in 
> a commonly used external library?

You may find this useful 
http://www.m1xa.com/en/article/d-language-chained-null-checks-maybe-monad.html



More information about the Digitalmars-d-learn mailing list