RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
From: Zeev Suraski Date: Mon, 14 Jul 2014 17:52:34 +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 13 Groups: php.internals Request: Send a blank email to internals+get-75501@lists.php.net to get a copy of this message
> -----Original Message----- > From: Rowan Collins [mailto:rowan.collins@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
Thread (250 messages)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- Re: [RFC] Scalar Type Hinting With Casts (re-opening)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- Re: [RFC] Scalar Type Hinting With Casts (re-opening)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- Re: [RFC] Scalar Type Hinting With Casts (re-opening)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- Re: [RFC] Scalar Type Hinting With Casts (re-opening)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- Re: [RFC] Scalar Type Hinting With Casts (re-opening)
- Re: [RFC] Scalar Type Hinting With Casts (re-opening)
- Re: [RFC] Scalar Type Hinting With Casts (re-opening)
- Re: [RFC] Scalar Type Hinting With Casts (re-opening)
- Re: [RFC] Scalar Type Hinting With Casts (re-opening)
- Re: [RFC] Scalar Type Hinting With Casts (re-opening)
| « previous | php.internals (#75501) | next » |
|---|