Re: [RFC] Square bracket syntax for array destructuringassignment
| From: | Andrea Faulds | Date: | Fri, 08 Apr 2016 11:26:53 +0000 |
| Subject: | Re: [RFC] Square bracket syntax for array destructuringassignment | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-92173@lists.php.net to get a copy of this message | ||
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 aboutI'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/[…]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?