From: Caleb Clausen Date: 2010-08-24T01:47:25+09:00 Subject: Re: Your thoughts on #memo ? On 8/23/10, Intransition wrote: > The use case for #memo is an alternative to: > > def m > @m ||= .... > end > > But differs in that it avoids the need for an instance variable. I > tend to use the "@m ||=" idiom a lot, though I wonder about it's > threading implications, and whether something like #memo would be more > robust. Your #memo method is no more re-entrant than the instance variable example you gave above. If you want it to be re-entrant, you need to have a mutex. Also, I seem to recall that methods defined via define_method are slower than methods defined via def. But I couldn't see a way to rewrite your code using def instead...