[ruby-core:89468] [Ruby trunk Feature#15236] add support for hash shorthand

From: lyoneil.de.sire@...
Date: 2018-10-19 10:33:02 UTC
List: ruby-core #89468
Issue #15236 has been reported by ignatiusreza (Ignatius Reza Lesmana).

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

* 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:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next