> [PL/I let you declare procedures as REDUCIBLE, which meant that they> were pure functions, and Fortran functions were supposed to be pure> functions (although most compilers didn't treat them that way due to> all of the bad code that people write.) But I think that was so that> the compiler could do common subexpression and dead code optimization> across function calls, not memoization. -John]

Ada allows procedures to be declared as "pure". I don't think any
compilers use this for memoization, but Ada compilers do use this
information to do things like moving calls out of loops.

Automatic memoization seems like a cool thing to do, but I would think
the programmer should have some control over which procedures this is
applied to. How could the compiler guess whether the lookup is faster
than calling the thing again? The programmer might also want control
over the lookup mechanism.