Re: [RFC] Scalar Type Hinting With Casts (re-opening)
From: Rowan Collins Date: Mon, 14 Jul 2014 16:14:04 +0000 Subject: Re: [RFC] Scalar Type Hinting With Casts (re-opening) References: 1 2 3 4 5 6 Groups: php.internals Request: Send a blank email to internals+get-75482@lists.php.net to get a copy of this message
Zeev Suraski wrote (on 14/07/2014):That's not consistent with current behaviour. This does not perform a cast, it performs strict validation: function foo(array $bar) { /* ... */ } foo('123'); Also, I already mentioned it:-----Original Message----- From: Rowan Collins [mailto:rowan.collins@gmail.com] Sent: Monday, July 14, 2014 6:28 PM To: internals@lists.php.net Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) Derick Rethans wrote (on 14/07/2014):anotherA compromise by adding more inconsistencies.The only way of not introducing some inconsistencies (or, to put itway, new features) is to use strict type hintsActually there's a pretty simple way that's not strict type hints: 5) Add type hints using existing syntax, which are casts; Change casts (both existing and these new ones) to emit a new E_CAST in case of data loss or 'bogus' conversions. ZeevOption 2 (or 3) could also be implemented by making *all* lossy casts emit some kind of notice.The only *consistent* behaviour is strict validation, period. If you want that, use Hack; if you want some other kind of type hint, it has to introduce something new.
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: [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 (#75482) | next » |
|---|