Re: [RFC] Scalar Type Hinting With Casts (re-opening)

From: Date: Tue, 15 Jul 2014 13:34:25 +0000
Subject: Re: [RFC] Scalar Type Hinting With Casts (re-opening)
References: 1 2 3 4 5 6 7 8 9 10 11 12 13  Groups: php.internals 
Request: Send a blank email to internals+get-75543@lists.php.net to get a copy of this message
On Tue, Jul 15, 2014 at 3:21 PM, Andrea Faulds <ajf@ajf.me> wrote: > > On 15 Jul 2014, at 14:18, Ferenc Kovacs <tyra3l@gmail.com> wrote: > > > you can't optionally introduce strict typing to php, as the two of them > > can't co-exists. > > nobody forces you to not use a language with strict typing if you want > > that, but I don't think that it would worth changing the php type system > at > > this point. > > It’s also worth noting that if you do want strict typing in PHP, you now > have an alternative: Hack. Hack even allows you to mix strictly-typed code > with non-strictly-typed code if you want. even Hack has some gotchas: http://grokbase.com/t/php/php-internals/1459q785wg/rfc-return-type-declarations-pre-vote-follow-up#20140509j1db9b91d2642wzbzbgte7k450 But PHP is not going to go in that direction. This RFC offer rather strict > validation of input to a function, but it does not offer strict *typing*, > as strings and floats, where interchangeable, are accepted. > yep > > > as I mentioned above, nobody argues that input validation (and escaping > > output in a context sensitive manner) is a must. > > Isn’t a must, surely? (I assume that was a typo) I wasn't talking about the rfc or the typehints, but having proper input validation in your application in general. -- Ferenc Kovács @Tyr43l - http://tyrael.hu

« previous php.internals (#75543) next »