[DGD] Re: casting nil (another idea...)

Robert Forshaw iouswuoibev at hotmail.com
Tue Mar 23 20:47:43 CET 2004


>From: Par Winzell <zell at skotos.net>
>>>In fact, given my druthers, if (!foo) would not be true for zero foo's...
>
>I'm saying the integer zero and the value nil do not really have that much 
>in common. The simplest counter-argument for somebody who wanted to argue 
>consistency would be, "Well, conditionals already treat zero and nil the 
>same." In other words,
>
>     if (nil)
>
>is identical to
>
>     if (0)

I think !!nil illustrates this best. : )

And just to further my point on equivelance, (string)1 evaluates to "1". In 
other words, "1" is the string equivilent of 1 (but is not equal to 1). I 
think logically, it follows that 0 is the integer equivilent of nil, perhaps 
not to the same precision but it makes sense to me. I think to rationally 
determine the merit of including such a feature as typecasting nil to 0, you 
have to weigh the problems it would introduce. Since casting (int) on a nil 
currently does nothing, and because nil and 0 have logical equvilence, I 
don't see it introducing any problems at all.

_________________________________________________________________
Sign-up for a FREE BT Broadband connection today! 
http://www.msn.co.uk/specials/btbroadband

_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list