in reply to Re: Re: Re: Re: Autoboxing: Yes or No?
in thread Autoboxing: Yes or No?
I thought about that, and even experimented with it, but if I use a Null Object I cannot write if( $elt->first_child) {...} anymore, I have to explicitely test for $elt->first_child->is_not_null everywhere, which I don't like, or I have to overload the boolean-ification of the objects, but I am not a fan of overloading, mostly for performance reasons.
I agree that what I ask for is syntactic sugar, but I think it is also quite a natural way to write code, so it might make sense to have this in the language. I like the idea of undef being the null object. Being able to have a false blessed reference would actually be even better, because in this case I would know to which class that flase value belongs.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re(6): Null objects in boolean context
by Ovid (Cardinal) on Jan 01, 2004 at 22:10 UTC | |
by rkg (Hermit) on Jan 01, 2004 at 22:57 UTC | |
by tilly (Archbishop) on Jan 02, 2004 at 00:54 UTC | |
by Ovid (Cardinal) on Jan 01, 2004 at 23:13 UTC | |
by mirod (Canon) on Jan 02, 2004 at 01:41 UTC |