Re: [RFC] Strict type hints (parameter and return value)

From: Date: Thu, 17 Apr 2008 15:29:53 +0000
Subject: Re: [RFC] Strict type hints (parameter and return value)
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-37073@lists.php.net to get a copy of this message
On Thu, Apr 17, 2008 at 5:24 PM, Felipe Pena <felipensp@gmail.com> wrote: > > Thanks for making the change. This is much more consistent. It remains > > that there is no 'scalar' or 'numeric' hint. Are you planning on > > including them? > > No, i'm not planning to do that. Ah, I should have been more specific. I meant to ask for those changes. Can I ask why not? > > I also wonder about allowing NULL for an 'array' type hint. Is this > > acceptable? The patch seems to indicate it is. If so, why is this > > allowed? > > I added yesterday an information about that in the doc: > > "Functions are now able to force parameters to be objects (by specifying > the name of the class in the function prototype) or arrays (since PHP > 5.1). However, if NULL is used as the default parameter value, it will > be allowed as an argument for any later call." That doesnt explain why its allowed. Can you elaborate? Thanks, Paul > > On Thu, Apr 17, 2008 at 4:42 PM, Felipe Pena <felipensp@gmail.com> wrote: > > > Hi. > > > > > > Well, thinking better about the behavior of type hinting, i decided to > > > change the proposal for strict type. I.e. don't accept numeric string > > > as an intenger, etc. > > > > > > If anyone wants use type hinting, i believe that it should be strict. > > > Otherwise, it makes more sense to not use it. > > > > > > Examples, patches and tests: > > > http://wiki.php.net/rfc/typehint > > > > > > > > > -- > > > Regards, > > > Felipe Pena. > > > > > > -- > > > PHP Internals - PHP Runtime Development Mailing List > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > -- > Regards, > Felipe Pena. > > -- Paul Biggar paul.biggar@gmail.com

« previous php.internals (#37073) next »