> > (Now, it would be nice to have another RFC about custom object casting 
> > to int, float and bool...)
>
> You mean like https://wiki.php.net/rfc/object_cast_to_types which is still in 
> draft?
>
> Note that __toBool would be problematic, since it would be called if the 
> object was used in an if statement, which could yield some very strange 
> results if it returned false (it would break the existing semantics about how 
> we can use if statements to determine if the type is populated)...
>
> Anthony

And yet, __toBool probably sits right next to __toArray in terms of the level 
of usefulness (maybe even beats it.) isset() can always be used to determine 
whether something was ACTUALLY set to a non-null value, and to some extent 
there is already a semantic problem anyway since things like if("0") resolve to 
false.

John Crenshaw
Priacta, Inc.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to