Re: [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters

From: Date: Fri, 09 Mar 2012 08:10:56 +0000
Subject: Re: [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-58808@lists.php.net to get a copy of this message
On Fri, Mar 9, 2012 at 3:32 AM, Anthony Ferrara <ircmaxell@gmail.com> wrote: > Hey all, > > As promised, I've created a POC patch to implement scalar type hints, > the way that zend_parse_parameters handles hinting.  First off, here's > the patch: Thanks for all the hard work you're putting into this :) > So, what do you think? This is the proposal I like most. It allows for some type juggling, but blocks off the ugly edge cases where dataloss would occur. Thinking in that direction I'd say that the casting rules are still too lax though: a) I'm not sure that we really want to accept '123abc' on an int cast with just a notice. In my eyes that is clearly malformed input, which should not be accepted. b) The bool cast rules also accept lots of input with dataloss. At least the fact that "abc" is considered a valid bool seems odd. Nikita

« previous php.internals (#58808) next »