> -----Original Message-----
> From: Rowan Collins [mailto:rowan.coll...@gmail.com]
> Sent: Monday, July 14, 2014 8:24 PM
> To: internals@lists.php.net
> Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
>
> Zeev Suraski wrote (on 14/07/2014):
> > I'd say absolutely yes, if they're PHP developers that's exactly what
> > they'd expect.  After all, if you use 'hello' today in any integer
> > context in PHP, explicit or implicit, that's exactly how it will
> > behavior across the language.
>
> And yet if you use it as a parameter to a type hinted function, it will
> produce
> an error.

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.

> You can be consistent with casts, or consistent with existing type hints,
> but not
> both.

Type looseness defines PHP.  Type hints do not.

Zeev

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

Reply via email to