Re: Memoization of pure-functional procedures

"Robert A Duff" <bobduff@shell01.TheWorld.com>
31 May 2002 23:06:17 -0400

          From comp.compilers

Related articles
Memoization of pure-functional procedures bear@sonic.net (Ray Dillinger) (2002-05-23)
Re: Memoization of pure-functional procedures bmd@cs.kuleuven.ac.be (Bart Demoen) (2002-05-27)
Re: Memoization of pure-functional procedures bobduff@shell01.TheWorld.com (Robert A Duff) (2002-05-31)
Re: Memoization of pure-functional procedures joachim_d@gmx.de (Joachim Durchholz) (2002-06-02)
| List of all articles for this month |

From: "Robert A Duff" <bobduff@shell01.TheWorld.com>
Newsgroups: comp.compilers
Date: 31 May 2002 23:06:17 -0400
Organization: The World Public Access UNIX, Brookline, MA
References: 02-05-115
Keywords: optimize
Posted-Date: 31 May 2002 23:06:17 EDT

Our esteemed moderator says:


> [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.


- Bob


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.