Partial evaluation in imperative languages.

Charles Fiterman <cef@geodesic.com>
30 May 1997 23:15:40 -0400

          From comp.compilers

Related articles
Lots of things are happening with ACM TOPLAS toplas@cs.umd.edu (1997-03-31)
Partial evaluation vs flow-graph analysis fabre@gr.osf.org (Christian Fabre) (1997-05-22)
Re: Partial evaluation vs flow-graph analysis mossin@diku.dk (1997-05-25)
Re: Partial evaluation vs flow-graph analysis thorn@spamblock.lalla.irisa.fr (Tommy Thorn) (1997-05-27)
Partial evaluation in imperative languages. cef@geodesic.com (Charles Fiterman) (1997-05-30)
Re: Partial evaluation in imperative languages. monnier+/news/comp/compilers@tequila.cs.yale.edu (Stefan Monnier) (1997-05-31)
Re: Partial evaluation in imperative languages. cliffc@risc.sps.mot.com (Cliff Click) (1997-06-02)
Re: Partial evaluation in imperative languages. cef@geodesic.com (Charles Fiterman) (1997-06-04)
Re: Partial evaluation in imperative languages. volanski@irisa.fr (1997-06-10)
| List of all articles for this month |

From: Charles Fiterman <cef@geodesic.com>
Newsgroups: comp.compilers,comp.lang.functional
Date: 30 May 1997 23:15:40 -0400
Organization: Geodesic Systems
References: 97-03-165 97-05-254 97-05-275 97-05-301
Keywords: optimize, theory

I think for partial evaluation to be useful in an imperative language
there must be language constructs to support it. I am experimenting
with this notion and we have the following.


frozen variable-list;
    The following variables are frozen, they have reached their final state.


pure
    In a function declaration this means the function may be regarded as
referentially transparent no matter what it looks like. This allows a
square root function with an error message to be treated as transparent.
You would rather see the message at compile time anyway.


impure
    In a function declaration it means the function may not be regarded
as referentially transparent. For example a delay function.


mac
    Do this now regardless. mac date; is the compile date. On a function
it means this is run at compile time. On a variable makes this a compile
time variable.


run
    Defer as far as possible, do at run time. May be put on a function
but may be overridden at compile time. This is the default for variables.


I regard strong typing as partial evaluation of the type system in
such a way that no errors may occur at run time. But there are many
times we don't want errors at run time. I don't ever want to hear "Is
there a programmer aboard the aircraft? I'm getting the message 'zero
divide error'"


I believe partial evaluation can be used to detect the possibility of
inappropriate error messages such as 'zero divide error' in a
navigation program or word processor. Using it that way would require
massive labor but there are systems where this is a good idea.
--


Post a followup to this message

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