2009/7/2 Stanislav Malyshev <s...@zend.com>:
> Hi!
>
>>    function func(int $i)
>>
>> for strict type checking, and
>>
>>    function func((int)$i)
>
> Without saying anything on the merits of having both syntaxes, visually I
> think this looks much nicer, even with the disadvantage of parentheses
> overload.

Oh look, auto-casting. And __cast() is excellent, but would be at odds
with __toString().

And then having __toBoolean(), __toInteger(), etc. might be a bit OTT.

How about __cast($type [,$class]) where $type is one of the T_xxx_CAST
constants and class is the required class for a class casting? (See
nearly already there!)

T_ARRAY_CAST
T_BOOL_CAST
T_DOUBLE_CAST
T_INT_CAST
T_OBJECT_CAST
T_STRING_CAST



-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
I need a car : http://snipurl.com/l4pih
ZOPA : http://uk.zopa.com/member/RQuadling

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

Reply via email to