Jesse Schalken wrote on 04/05/2016 13:20:
(maybe there should be a $ before the property names, not sure)

And there's the rub! :P

When named parameters have been discussed before, there was a lot of bikeshedding over what the syntax should look like, and this is arguably a very similar feature.

You could either think of this as "setting lots of variables":

new Foo { $bar = 1, $baz = 2 }

or you could think of it as "an object literal like an array literal":

new Foo { 'bar' => 1, 'baz' => 2 }


And then we also need to think about sitting nicely with anonymous class syntax. Not to mention Joe's proposal for lexical scope: https://wiki.php.net/rfc/lexical-anon


For the record, I like the idea, if we can come up with a consistent plan for how these pieces of syntax will work together, and not paint ourselves into an ASCII-art hole...

Regards,
--
Rowan Collins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to