From: "Mauricio Fernández" Date: 2004-08-06T01:56:47+09:00 Subject: Re: Macros in Ruby On Fri, Aug 06, 2004 at 01:38:08AM +0900, Sean O'Dell wrote: > module ModOne > @var = "one" > > TestProc = Proc.new do > @var > end > end > > module ModTwo > @var = "two" > > ModOne::TestProc.call #=> "two" > end In this particular case, it can be solved with batsman@tux-chan:/tmp$ cat hfdh.rb module ModOne @var = "one" TestProc = Proc.new do @var end end module ModTwo @var = "two" p instance_eval(&ModOne::TestProc) #=> "two" end batsman@tux-chan:/tmp$ ruby hfdh.rb "two" > ...perhaps making a new class named "Macro" which is essentially Proc, but > which executes in the current binding instead of the binding where it was > created. I do agree on the fact that better control of the bindings (as often proposed in the past) would make several of the things people would want to do with macros possible without further language modifications. -- Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com