Re: [RFC] Object Initializer
| From: | Michał Brzuchalski | Date: | Fri, 13 Sep 2019 09:22:48 +0000 |
| Subject: | Re: [RFC] Object Initializer | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-107067@lists.php.net to get a copy of this message | ||
Hi Mike,
I am curious why your RFC uses "=" instead of "=>" for separating
> properties from values?
>
> If we used "=>" it is potential — with lookahead parsing — that the
> following could be unambiguous:
>
> { foo => 10 }
>
>
The reason about choosing "=" was a simplification of instantiation and
properties initialisation
and we use "=" to assign property values now.
The "=>" is specific for array key pairs and IMO should stay specific for
arrays only.
Thanks,
Michał Brzuchalski