Is this valid syntax? I ask specifically because of the '.' character there. I am not
a big fan of the & anyway though, so I am biased. I am just wondering in context of
syntax such as:
hash[:key]
hash&[:key]
hash&.[:key]
Actually I only consider the first elegant, the rest ugly. But I see your point
in regards to hash&. versus hash&.[:key] - if the former already works
as-is, then it may make sense to allow for the latter. What I thought was that
the '.' is explicit for the method call; I guess the last example:
hi. I would like to use hash&.[key] (or hash&[key] ) in following cases as below.
classXdefinitialize@hash={a: 1,b: 2,c: 3}enddef[](key)@hash[key]endenddefget(key)x=Symbol===key&&X.new||nil# I want to use x&.[key] (or x&[key])x&.[](key)endpget(:a)#=> 1pget("b")# => nil