On Fri, 2008-04-25 at 10:06 -0700, Stanislav Malyshev wrote:
> Hi!
> 
> In general, it'd be very nice to have some definition of the proposed 
> feature beyond the patch. It would probably answer some of my questions 
> that follow :)
> 
> > parameters and return values. Objects with __toString methods are
> > allowed to pass for scalar and string type hints.
> 
> What about objects that can be converted to other types (cast_object 
> handler)?

Hadn't thought about these, don't see why it couldn't be added though.

> > function myTypedFunction returns int(string $stuff, bool, $things, num
> > $amount) {
> >     return 'This will cause an error.'
> > }
> 
> What about return "1"? Also I notice it introduces new keyword - 
> returns. Is it necessary? Each new keyword means broken code.

We could probably find a way to use the return keyword or another
syntax, I just did it like this for simplicity.

> > Parameters and return values are strict. Int means int (to the type),
> 
> Meaning that int would reject 1.0, true and "1"? bool would reject 1 and 
> 0 and null? Ouch, ouch, ouch.

As it is now, yes, this works just like parameter hints. Could be
changed if decided upon.




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

Reply via email to