From: dblack@... Date: 2007-08-17T08:37:59+09:00 Subject: Re: Lazy function definition pattern in Ruby? Hi -- On Fri, 17 Aug 2007, Logan Capaldo wrote: > On 8/16/07, dblack@rubypal.com wrote: >> Hi -- >> >> On Fri, 17 Aug 2007, Logan Capaldo wrote: >> >>> On 8/16/07, dblack@rubypal.com wrote: >>>> A possible problem with that code is that it only works for one >>>> instance of Bar: >>> >>> That's easily fixable, just s/@/@@/ >> >> As long as you don't want to do the same thing in a subclass.... > Everything is a tradeoff. I'm not sure what the disadvantage of the local variable is, though. It seems like a good fit, since all you need it for is the local purpose of preserving it in the new definition. David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)