Re: [RFC] Object Initializer
| From: | Mike Schinkel | Date: | Fri, 13 Sep 2019 09:29:12 +0000 |
| Subject: | Re: [RFC] Object Initializer | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-107068@lists.php.net to get a copy of this message | ||
> IMO should stay specific for arrays only.
Why? Is there an objective reason?
Is there some aspect of the syntax that makes it appropriate for arrays but inappropriate for object
initialization?
These are honest question.
My two cents: I would like to type less too, but I have always assumed that "=>" was
the PHP-ish syntax for initialization of a structure so it seems very appropriate to use for object
initialization too.
That said,
1. I don't feel strongly about iti either way,
2. Unless using "=>" would make naked object initialization possible — i.e. { foo
=> 10 } — given that it seems, as Arnold said, this would conflict with other meanings: { foo =
10 }
#fwiw
-Mike