Purity (D2 standard libraries / object.d)
Stewart Gordon
smjg_1998 at yahoo.com
Sat Jan 10 11:23:55 PST 2009
Walter Bright wrote:
> Michel Fortin wrote:
>> Hum, could the compiler be trusted to add the memoization code to pure
>> functions so they can stay pure?
>
> If the compiler does general memoization on pure functions, all it has
> to do is use the bits of the arguments passed on the stack to the
> function as an index into an associative array of the return values.
<snip>
Walter, before you go and implement any of this, I must point out that
it's spelt "memorization" and "memorize". (Or "memorisation" and
"memorise" if you're British, but that's an aside.)
Stewart.
More information about the Digitalmars-d
mailing list