[ruby-core:69027] Re: [Ruby trunk - Feature #11105] ES6-like hash literals

From: Alfredo Bravo Cuero <yo@...>
Date: 2015-04-30 02:38:21 UTC
List: ruby-core #69027
Hola matz


Alfredo Bravo Cuero (@abracu)
Open Source culture advocate and Ruby on Rails Developer 
| Skype: yo@alfredobravocuero.co | Cel +573192837240

Enviado desde mi iPad

> El 29/04/2015, a las 9:36 p.m., matz@ruby-lang.org escribi坦:
> 
> Issue #11105 has been updated by Yukihiro Matsumoto.
> 
> 
> Question:
> 
> What if we have variables with same name and different prefixes? e.g.
> 
> a = 1
> @a = 2
> $a = 3
> 
> Matz.
> 
> ----------------------------------------
> Feature #11105: ES6-like hash literals
> https://bugs.ruby-lang.org/issues/11105#change-52282
> 
> * Author: Shugo Maeda
> * Status: Open
> * Priority: Normal
> * Assignee: 
> ----------------------------------------
> Why not support ECMAScript6-like hash literals?
> 
> For example,
> 
>    {x, y}
> 
> is equivalent to:
> 
>    {x: x, y: y}
> 
> For convenience, the prefix of global, instance, and class variables should be removed from the key name as follows:
> 
>    a = 1
>    B = 2
>    $c = 3
>    @d = 4
>    @@e = 5
>    p({a, B, $c, @d, @@e, f: 6})
>    #=> {:a=>1, :B=>2, :c=>3, :d=>4, :e=>5, :f=>6}
> 
> 
> ---Files--------------------------------
> 0001-support-ES6-like-hash-literals.patch (3.88 KB)
> 
> 
> -- 
> https://bugs.ruby-lang.org/

In This Thread

Prev Next