Spec#, nullables and more

tls do at notha.ev
Sat Nov 6 12:54:19 PDT 2010


bearophile Wrote:

> Walter:
> 
> > retard wrote:
> > > In a functional language:
> > > 
> > > start_the_car c = case c of
> > >   Just car -> start car
> > >   Nothing -> error "not initialized"
> > 
> > And the null pointer exception is reinvented!
> 
> That "case" statement (is a pattern matching) forces you to manage the null case everywhere you use a Nothing-able type like that, otherwise your program doesn't compile. In a language like D the compiler doesn't remind you to manage the null case, so you may forget it. And experience shows that indeed in many people around the world forget to test it and important programs stop running. When you are running a program, it's not nice to see it stop in the middle of its work.

Walter make this point earlier. That it imrpoves development time when real hardware segfault happens. These other nulls causes runtime or compile time unnecessary checks just like testing prime numbers. Thus not there is need for nonnull pointers. It only complicate the way you think algorithms and make programming hard. I never seen segfault in practice. Have you? I download latest version always it works. And cheap in copy markets.

> 
> This request of explicit management of nulls is indeed the second half of the nonnull proposal I have explained in my enhancement request. There are several ways to face this in D, and so far only a person in this thread has touched this second part of the proposal.

Walter touched? He gives through out analysis and I think its good the way is now.



More information about the Digitalmars-d mailing list