> -----Original Message-----
> From: Andrea Faulds [mailto:a...@ajf.me]
> Sent: Wednesday, July 16, 2014 11:45 PM
> To: Zeev Suraski
> Cc: Stas Malyshev; Andrey Andreev; Rowan Collins;
internals@lists.php.net
> Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
>
>
> On 16 Jul 2014, at 21:43, Zeev Suraski <z...@zend.com> wrote:
>
> >> anything this RFC permits will
> >> be permitted by zpp, it's the reverse that isn't necessarily true.
> >
> > Right, so it needs to be fixed.  It makes no sense to force a new
> > agenda on the language that's inconsistent with the rest of the
> > language.  Align your new feature to the rest of the language, not the
other
> way around.
>
> But to do so would be to make the feature less useful, nor satisfy
people who
> want stricter hinting.

Stricter typing does not belong in PHP.  If it did, we'd have it in
internal functions, implicit casting and the rest of the language in
general.  We don't.

And I insist that much like you said people can catch E_RECOVERABLE_ERROR
and turn ignore it, they can do the same with E_CASE - except now they
won't *have* to learn about this new behavior unless they explicitly want
to.  While you think it may not be strict enough for some people, and I
think it'd be too strict for others - the consistency argument should make
the decision between the two obvious.

Also, I tend to agree with Stas that we can consider to do
E_RECOVERABLE_ERROR on the obviously 'bogus' conversions - like array or
object to int.  But E_RECOVERABLE_ERROR on simple data loss is radically
inconsistent with the rest of PHP.

Sorry, I introduced hinting into PHP;  I intentionally did not add typing
for scalars as it goes against the fundamentals of the language, and I
fought this off back in 2008, 2010 and mildly also in 2012.  Call me
persistent :)

FWIW, I think the distance between where you and I stand is not that big -
and if we go in the direction of E_CAST for data loss across the board
(any implicit casts, not just in type hints), and E_RECOVERABLE_ERROR for
completely broken type conversions - this is a big win for PHP, beyond
just type hints.

Zeev

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to