From: Charles Oliver Nutter Date: 2009-01-14T16:29:47+09:00 Subject: [ruby-core:21337] Re: Proc-as-Binding is out again? James M. Lawrence wrote: > require 'quix/vars' > > def f(opts) > a, b, c = nil > Quix::Vars.hash_to_locals { opts } > p b > end def f(opts) a, b, c = nil Quix::Vars.hash_to_locals opts, binding p b end Now I know I'm handing the keys to my local scope to some other call, and the world isn't as scary! > class A > attr_reader :x, :y, :z > def initialize(x, y, z) > Quix::Vars.locals_to_ivs {%{x, y, z}} > end > end Quix::Vars.locals_to_ivs %{x, y, z}, binding Better! :) If it's the extra size of the binding call that people object to, I wouldn't be opposed to another magic variable that does the same thing...is $- taken? If it's the extra parameter...I agree partly, but I feel better with it explicit. - Charlie