The maybe operator WAS: Null references

Regan Heath regan at netmail.co.nz
Tue Aug 21 04:47:27 PDT 2012


On Tue, 21 Aug 2012 12:32:31 +0100, bearophile <bearophileHUGS at lycos.com>  
wrote:

> The very good Mark C. Chu-Carroll has written a little blog post about  
> the lack of null-related errors in his Scala code:
>
> http://scientopia.org/blogs/goodmath/2012/08/20/nulls/

This article links to:
http://beust.com/weblog/2012/08/19/a-note-on-null-pointers/

very early on.  Which is also a good read, and has parallels with the NaN  
discussion as well :p

I really like the Groovy/Fantom/Kotlin syntax shown:

[quote]
For example, here is how Kotlin lets you ignore null values encountered  
along a chain of invocations:

   bob?.department?.head?.name

If either of these accesses returns null, the result of this expression  
will be null. No need to put your values into monadic boxes nor mapping  
through them, just use the standard composition operator you are familiar  
with if you are using a C family language.
[/quote]

I think this would be a neat D feature.

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d mailing list