Nullable types

Sergey Gromov snake.scaly at gmail.com
Tue Oct 21 09:47:10 PDT 2008


Tue, 21 Oct 2008 09:25:56 +0800,
Lionello Lunesu wrote:
> 
> "Olli Aalto" <oaalto at gmail.com> wrote in message 
> news:gdhud3$1o0o$1 at digitalmars.com...
> > In Objective-C you can call methods on null(nil in Obj-C) objects. The 
> > call is silently ignored. So no more crashes or NPEs.
> >
> > The problem with this is that if you call a method on a null object and 
> > try to use the return value as an initializer for a local variable, it 
> > will be set to 0 for numbers, nil for objects, and so on. This can lead to 
> > hard to find bugs.
> 
> :-O That sounds disastrous!
> 
> Although it sounds like D's NaN initializer: if there's even one NaN 
> somewhere in a big calculation, the result of the calculation will likely be 
> NaN as well. And here it helps finding bugs.

Yeah, I've spent some time hunting that NaN.  I wish I had an exception 
instead.



More information about the Digitalmars-d mailing list