I think one possible question in regards to the suggestion here is whether the above method may be useful
on its own, even without a shorthand syntax for Hash. (This is really just a question; I personally am
not having any strong pro/con opinion.)
I also understand that using a method is different compared to the other two proposals. For example,
{ a }
{ a: a}
and
{x, y}
{x: x, y: y}
is different to:
meth = 42
p expand(:meth) # => {:meth=>42}
So using a method is different to the other two proposals (in the two older
issue request, by Ignatius and Shugo Maeda). Perhaps one or more use cases
could be described for a new method to be useful even without the hash
shorthand notation? I can not think of a good one right now but perhaps others
have some ideas.
Interesting feature, but I don't think the name Kernel#expand is acceptable.
Maybe an instance method of Binding?
And I think it should raise a NameError instead of a NoMethodError on invalid names.
I don't think expand is the right name for the behavior
meta-programming is too much for this half-baked substitute for #15236
Regarding #15236, we are waiting for the time when our recognition changed to accept the JS behavior. Currently, we (at least me) recognize {a,b,c} as a literal for a set, not a shorthand for {a:a,b:b,c:c}. I am neutral. I don't want Ruby to follow every JS behavior.