H
Hal Fulton
No, this isn't April Fool's Day. I'm seriously wondering
if this has ever been considered.
I can only think of one place I'd use it -- to turn hashes
(used as named parameters) into real variables.
Something like:
def meth(hash)
bind = binding
hash.each_pair {|k,v| local_variable_set(k,v,bind) }
# Assuming call was: meth(alpha: 123, beta: 234, gamma: 345)
# we now can reference alpha, beta, and gamma as ordinary
# variables...
end
Thoughts?
Hal
if this has ever been considered.
I can only think of one place I'd use it -- to turn hashes
(used as named parameters) into real variables.
Something like:
def meth(hash)
bind = binding
hash.each_pair {|k,v| local_variable_set(k,v,bind) }
# Assuming call was: meth(alpha: 123, beta: 234, gamma: 345)
# we now can reference alpha, beta, and gamma as ordinary
# variables...
end
Thoughts?
Hal