memoize

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jan 4 10:33:02 PST 2011


On 1/4/11 12:27 PM, Nick Sabalausky wrote:
> "Michel Fortin"<michel.fortin at michelf.com>  wrote in message
> news:ifvo9g$2d53$1 at digitalmars.com...
>> On 2011-01-04 12:53:43 -0500, bearophile<bearophileHUGS at lycos.com>  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.

Even before that. There may be a visible difference between the first 
invocation and all others.

Andrei


More information about the Digitalmars-d mailing list