Project

General

Profile

Feature #15236

add support for hash shorthand

Added by ignatiusreza (Ignatius Reza Lesmana) almost 2 years ago. Updated 29 days ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:89468]

Description

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)..


Related issues

Related to Ruby master - Feature #15286: Proposal: Add Kernel.#expand(*args)RejectedActions
Is duplicate of Ruby master - Feature #11105: ES6-like hash literalsRejectedActions

Also available in: Atom PDF