From: Robert Klemme Date: 2007-11-16T21:43:41+09:00 Subject: Re: Shadowing bug?? 2007/11/16, Vasco Andrade e Silva : > Robert Klemme wrote: > > 2007/11/15, Vasco Andrade e Silva : > >> >> {:xpto=>"ohoh"} # :-) > >> process of that computation you call "defn_to_sexp". This method > >> ... > >> in both cases". > >> ... > >> end > > > > IMHO you are abusing a lambda to get a nested method. This likely > > also has performance impacts since the block has to be recreated on > > every invocation of the method. In this case I'd rather use a private > > helper method. > > > > But I can see how you would want to use the same identifier in some > > cases. I can only speak for myself: I did not feel the urge to do > > this (yet). > > I think that has to do a lot with your "school". > Have a try with it, i'm sure you'll love it after while :P This is a melody that drastically increases the likelihood that I do *not* do it because it is usually used by people that want my money. :-)) From what I've seen so far I do not think I gain any advantages, so sorry, I stick with my "old school". :-) > Let me only add if you want performance in this case you could just do: > @process_args ||= lambda do |node, has_block| > ... # i don't want to access to the outer node > # and "node" says more than "n" > end > > this is a very simple cache system ;) Yes, and it has the drawback to at least potentially hold on to objects longer than needed... :-) Kind regards robert -- use.inject do |as, often| as.you_can - without end