RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
| From: | Zeev Suraski | Date: | Wed, 16 Jul 2014 09:29:13 +0000 |
| Subject: | RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-75582@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Andrea Faulds [mailto:ajf@ajf.me]
> Sent: Tuesday, July 15, 2014 10:48 PM
> To: Andrey Andreev
> Cc: Rowan Collins; Stas Malyshev; internals@lists.php.net
> Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
>
>
> On 15 Jul 2014, at 20:43, Andrey Andreev <narf@devilix.net> wrote:
>
> > I'm sorry, I know what you mean here and I'm not criticizing you
> > specifically (in fact, I'm intentionally taking it ouf of context),
> > but that's "PHP internals", not "PHP community".
> >
> > The PHP community that I know, wants to have _both_ type cast hinting
> > and strict type declarations.
>
> I'm not sure that's quite the case. There are camps wanting one, there
are
> camps wanting the other, I suppose some want both, but to me that seems
like
> a not-a-compromise compromise solution. The point of this RFC, to some
> extent, is to be a reasonable compromise between completely strict
> declarations and cast hinting, providing the safety of the first and the
flexibility
> of the second. I think it strikes the balance well.
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.
Why insist E_RECOVERABLE_ERROR and introduce this effectively new set of
rules, instead of switching to E_CAST and maintain consistency?
Maintaining consistency is a HUGE deal. Every such feature we add that
you need to learn more rules/exceptions for make PHP harder to learn.
Zeev