Re: Scalar Type Hints v0.4

From: Date: Wed, 18 Feb 2015 00:58:23 +0000
Subject: Re: Scalar Type Hints v0.4
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-83016@lists.php.net to get a copy of this message
On Tue, Feb 17, 2015 at 4:35 PM, Nikita Popov <nikita.ppv@gmail.com> wrote: > I don't like the way this is heading with regards to internal functions. > Apart from better inter-compatibility, the primary appeal of Andrea's > proposal was that we have the option to make not only userland function > calls strict, but internal ones as well. With these modifications this is > lost for all practical purposes. (*) > Personally, I agree with you. I liked Andrea's proposal a lot, and if we put this back up for vote it probably would pass the 2/3rd majority needed. That said, if we can build a better consensus, we should try to. > I don't buy into Rasmus arguments about internal functions. They concern one > particular edge case (int->float coercion) and I doubt they have much > relevance if applied to codebases with pervasive use of typehints (where you > can be reasonably sure of the types of your variables). Even if, for the > sake of argument, we acknowledge the concern as valid we should be > discussing that particular case (int->float coercion) rather than dropping > the strict typing for internal functions altogether. > I don't fully buy into it either, particularly if we apply meta-types/unions. I do have to acknowledge his point about "encouraging the use of blind casts" though. Having a mass of PHP standard library functions suddenly look typed or apply a different set of coercion rules than one is used to is potentially dangerous. -Sara

« previous php.internals (#83016) next »