> I'll post the source for Ref is another posting for those that wish to > puzzle over it before seeing the solution. Here it is ... class Ref def initialize(&block) sym = block.call fail "Block must yield symbol" unless Symbol === sym @getter = eval "proc { #{sym} }", block @setter = eval "proc { |v| #{sym} = v }", block end def value @getter.call end def value=(v) @setter.call(v) end end -- -- Jim Weirich jweirich / one.net http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)