Jason House wrote:
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. The problem is identifying if this would be faster than recomputing the return value.

What about a compiler hint similar to inline or register?

Maybe making a conscious effort to leave the language feature as a last resort action would be better. Creating a memoization feature is a fish, creating a language that allows implementing memoization is fishing. :o/

Andrei

Reply via email to