[PRL] Type-directed partial evaluation

David Herman dherman at ccs.neu.edu
Thu Jan 8 15:54:43 EST 2004


> 2) things go to hell in a handbasket in the presence of primitives and 
> set!, right?  This is like parametricity; the result of the function 
> can only be one of a few things, and if we pass in a bunch of gensyms, 
> we can characterize the output directly.  In the presence of set!, 
> there's no way to know whether the function will behave the same way 
> the second time.

Yes, I believe set! screws everything up. Primitives in the sense of 
delta constants are fine, but I think effectful primitives won't work. 
I don't understand your parametricity point.

> 3) The natural conclusion is that programming with set! is dangerous 
> and makes it hard to reason about your programs, which I certainly 
> agree with.

But that doesn't mean it wouldn't be nice to be able to use this 
technique with effectful code. For example, taking a compiled program 
and trying to embed it into a host program. You could use TDPE to 
specialize the host program for the embedded program in order to 
optimize it or improve error reporting, and you'd like to be able to 
allow the embedded program to perform side-effects. I wonder if there's 
a way to use CPS or monadic style?

That was all very fuzzy, because I don't quite know what I'm talking 
about yet.

Dave



More information about the PRL mailing list