Re: Proposal: shorthand object property setting syntax.
| From: | Martin Jansen | Date: | Sat, 27 Mar 2010 16:23:19 +0000 |
| Subject: | Re: Proposal: shorthand object property setting syntax. | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-47656@lists.php.net to get a copy of this message | ||
On 27.03.10 17:02, Toorion wrote:
> $myLongNameObject = new MyLongNameObject();
> $myLongNameObject->property1 = '11111';
> $myLongNameObject->property2 = '22222';
> $myLongNameObject->property3 = '33333';
> $myLongNameObject->property4 = '44444';
> $myLongNameObject->property5 = '55555';
[...]
> $MyLongNameObject = new MyLongNameObject() {
> $property1 = '1111';
> $property2 = '2222';
> $property3 = '4444';
> $property4 = '5555';
> }
What exactly do you gain with the new syntax? You don't save LOC with
it (actually it requires one more line) and you still have to type all
the property names. Using an editor with code completion one can
produce the code in the current syntax pretty quickly after all.
- Martin