RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)

From: Date: Wed, 16 Jul 2014 11:05:07 +0000
Subject: RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.internals 
Request: Send a blank email to internals+get-75586@lists.php.net to get a copy of this message
> -----Original Message-----
> From: Rowan Collins [mailto:rowan.collins@gmail.com]
> Sent: Wednesday, July 16, 2014 1:25 PM
> To: internals@lists.php.net
> Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
>
> Zeev Suraski wrote (on 16/07/2014):
> > For me the introduction of a new set of rules is a deal breaker.
> > I'm -1 on the RFC the way it is, and +1 if we implement these 'hints'
> > as implicit casts, plus change implicit casts to emit E_CAST in case
> > of loss of data or 'bogus' conversions.
>
> Just to be clear, implementing E_CAST would require introducing a set of
> rules
> for when to throw it. By a strict reading of your message, that's a deal
> breaker.

Well, not really.
First, like all strict notices, they'd be off by default, so standard
behavior won't change at all from now, and 'type hints' behavior will be
identical to that, so again, nothing new to learn other than the new syntax.
Secondly, if you do enable E_CAST - you may have to slightly *modify* your
understanding of implicit casts, but you won't have to learn two different
sets of rules.  New users will see just one consistent set.

Zeev


Thread (250 messages)

« previous php.internals (#75586) next »