Issue #6414 has been updated by rosenfeld (Rodrigo Rosenfeld Rosas).


sorry but I couldn't find the proposal you're talking about, but looking at the examples it seems there is no difference.

But one thing that is supported in CoffeeScript and is not in the examples is to mix both forms. For example, in Ruby, that would mean:

b = 2; d = 4
{a: 1, b, 'c' => 3, d } == { :a => 1, :b => b, 'c' => 3, :d => d }
----------------------------------------
Feature #6414: Destructuring Assignment 
https://bugs.ruby-lang.org/issues/6414#change-27759

Author: edtsech (Edward Tsech)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: 2.0.0


I mean:

john = {name: "John", last: "Smith"}
{name, last} = john # extract value by key from the hash and set to local variable with same name
name # => "John"
last # -> "Smith"

Useful for ex. for  "options" hashes:
def select(options={})
  {only, except} = options
  ...
end

As extra part of this feature can be hash constructing in this way:

name = "John"
last    = "Smith"
find({name, last}) # equals to => find({name: "John", last: "Smith"})

I think both really nice to have in Ruby.
Thanks.


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