Issue #15236 has been updated by ignatiusreza (Ignatius Reza Lesmana).


janfri (Jan Friedrich) wrote:
> I think the use of destructuring for this is much more Rubyish than the ES6 syntax.

Agreed that destructuring hash is very much ruby, since destructuring array is already supported.. but, I think supporting that does not mean that we can't support this one too.. in fact, I think supporting both would be best, since I would expect that if I can do one, I should also be able to do the other..



----------------------------------------
Feature #15236: add support for hash shorthand
https://bugs.ruby-lang.org/issues/15236#change-74661

* Author: ignatiusreza (Ignatius Reza Lesmana)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
PR in github: https://github.com/ruby/ruby/pull/1990

inspired by javascript support for object literal shorthand notation `{ a }`, which will be expanded into `{ a: a }`..

to avoid ambiguity, this shorthand is only supported when hash is defined with `{ }` notation.. in other situation where the brackets is optional, e.g. function call, we still need to write it in full (`m(a : a)` instead of `m(a)`, or `m(a, b, c: c)` instead of `m(a, b, c)`..



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>