From: Brian Buckley Date: 2005-10-20T01:31:06+09:00 Subject: Re: declaratively caching results of a method > > > Alrighty, then. I'll make that change in the next release. Here's another change to memoize for your consideration: Suppose the result of a method call is nil or false, and suppose is takes a lot of work to find that out. As written, methods that return nil or false are not getting speedups from memoize. How about changing memoize to something like below? define_method(name) do |*args| #cache[args] ||= meth.call(*args) #what if the cached value is nil or false? cache.has_key?(args) ? cache[args] : cache[args] ||= meth.call(*args) end Brian