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

From: Date: Mon, 14 Jul 2014 17:59:12 +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 14  Groups: php.internals 
Request: Send a blank email to internals+get-75503@lists.php.net to get a copy of this message
On 14 Jul 2014, at 18:52, Zeev Suraski <zeev@zend.com> wrote: > Type hints were first and foremost introduced for object oriented safety, as > a part of the major OO model shift Andi and I pushed for in PHP 5.0. What > you may be alluding to - type hints for arrays and objects - were added at > later time and introduced that small inconsistency you're talking about. > Still, type juggling for scalars has been the fundamental nature of PHP > since the get go; Type jugging for arrays/objects was always more of an > edge case and perhaps even a misfeature. I’m not sure we actually do “juggle” arrays and objects much, do we? You can cast to them, sure, because PHP as a rule allows you to cast anything to anything explicitly (bar resources), but I can’t, for example, do a loose comparison between an array and a string. -- Andrea Faulds http://ajf.me/

« previous php.internals (#75503) next »