Re: [RFC] Scalar Type Hinting With Casts (re-opening)
| From: | Andrey Andreev | Date: | Mon, 14 Jul 2014 13:19:23 +0000 |
| Subject: | Re: [RFC] Scalar Type Hinting With Casts (re-opening) | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-75448@lists.php.net to get a copy of this message | ||
Hi,
On Mon, Jul 14, 2014 at 4:12 PM, Alexey Zakhlestin <indeyets@gmail.com> wrote:
> Some people talk about inconsistency, which is introduced by reusing same syntax for
> "strict parameter types" and "scalar parameter casts”. There’s some truth there.
> Let’s use different syntax.
>
> This might work:
>
> function foo((int) $a)
> {
> var_dump($a);
> }
>
> I would read it as declaration-level casting
I strongly support this.
What we currently have with class/array typing is a different behavior
(regardless of the details behind it), and this syntax would make that
noticeable, which is a great thing.
Cheers,
Andrey.