On 2011-01-04 13:27:59 -0500, "Nick Sabalausky" <[email protected]> said:

"Michel Fortin" <[email protected]> wrote in message
news:[email protected]...
On 2011-01-04 12:53:43 -0500, bearophile <[email protected]> said:

Regarding the purity of memoize, a kind of compiler-blessed built-in
memoization for pure functuions allows pure memoization... (It is a
trusted pure, where the trusted entity is the compiler)

One could even argue that memoize makes impure functions pure because as
long as you don't clear the cache, memoize!func is guarantied to return
the same value for the same arguments.

...until maxSize is exceeded and the cache is cleared.

Right, of course. I was speaking about the case where there is no maximum size (or maxSize == uint.max). I'm not saying it's a good idea in general, just that it has an interesting property.


--
Michel Fortin
[email protected]
http://michelf.com/

Reply via email to