dereferencing null - what about something like an check-scope?

David Eagen dontmailme at mailinator.com
Thu Mar 8 09:32:48 PST 2012


I like the way Scala handles this with the Option class. None 
indicates no value which is equivalent to your null sentinal 
value but it is a value itself so it is always safe to use.

Combined with pattern matching and the orElse methods makes it 
very easy to use one variable that both stores the value and at 
the same time indicates whether it is valid or not. It's not two 
variables that could get out of sync.


More information about the Digitalmars-d mailing list