Hi Ivan,
Ivan Enderlin wrote:
Thanks a lot for this RFC. Huge +1 from the all Hoa's community and myself.
However, did you discuss about `[…]` vs. `{…}`? Most of the time, arrays
or vectors constructing are represented by `[…]` symbols while
destructing are represented by `{…}`. What your point of view or
arguments here?
I'm not sure I understand what you mean. In JS, for example, you use {}
to create an object or for destructuring assignment for an object. But
you don't use {} for other cases. [] is used to create arrays and for
destructuring assignment from arrays. The pattern resembles the syntax
for constructing what it matches against. In Haskell, (…,…) is used for
constructing a tuple and pattern-matching against it.
I can't think of a language where {…} is used for destructuring or
pattern-matching against something which is not written with {…}.
Does that make sense?
--
Andrea Faulds
https://ajf.me/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php