For "Destructuring", you can use one-line pattern matching since Ruby 3.0:
hash = {a: 'a', b: 'b'}
hash => { a:, b: }
p hash[:a] #=> "a"
For "Constructor", it is a long-running topic: #14579, #17292, and maybe other tickets I cannot remember. But as far as I recall, no one proposed this particular syntax %C{ }.
Subject changed from Hash shorthands (matching constructors and destructuring functionality in JS) to Hash shorthands (matching constructors functionality in JS)
For "Destructuring", you can use one-line pattern matching since Ruby 3.0:
hash = {a: 'a', b: 'b'}
hash => { a:, b: }
p hash[:a] #=> "a"
For "Constructor", it is a long-running topic: #14579, #17292, and maybe other tickets I cannot remember. But as far as I recall, no one proposed this particular syntax %C{ }.
Thank you, haven't had enough of a chance to play with Ruby 3. Clearly I missed things.
I've updated to remove the reference to the destructuring. I've also made a slight update to make it more consistent with ruby's existing % literal constructors (as that's the intent here)
For "Destructuring", you can use one-line pattern matching since Ruby 3.0:
hash = {a: 'a', b: 'b'}
hash => { a:, b: }
p hash[:a] #=> "a"
For "Constructor", it is a long-running topic: #14579, #17292, and maybe other tickets I cannot remember. But as far as I recall, no one proposed this particular syntax %C{ }.
For "Destructuring", you can use one-line pattern matching since Ruby 3.0:
hash = {a: 'a', b: 'b'}
hash => { a:, b: }
p hash[:a] #=> "a"
For "Constructor", it is a long-running topic: #14579, #17292, and maybe other tickets I cannot remember. But as far as I recall, no one proposed this particular syntax %C{ }.
Yes, fair find! If google translate is translating correctly it seems the exact same specification.
Sorry, should have done a better job searching for it!