[plt-scheme] r6rs eval + phases + exceptions

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed May 21 07:48:45 EDT 2008

At Tue, 20 May 2008 23:00:44 -0400, Stephen Wrobleski wrote:
> I have a a bit of a problem with values getting passed between phases. I'm
> calling r6rs:eval on an expression that may throw arbitrary exceptions in a
> syntax expander. As such, a value from phase 1 (of the eval) has now escaped
> into phase 0 of the running program. I would like to programmatically test
> for these exceptions, but of course none of my phase 0 predicates work
> because they're from a different instantiation. (Actually the r6rs condition
> library predicates don't work either, so r6rs:simple-conditions ends up
> mangling the exception)

I think `eval' called from a phase 1 context should use phase 1
instances of modules, instead of phase 0 instances, which would avoid
this cross-phase mismatch. The same problem shows up when trying to use
`deserialize' within compile-time code.

Unfortunately, I don't think this is going to be fixed in v4.0, because
it will take some time to track down all the places in the code that
assume top-level evaluation starts in phase 0. Hopefully we can fix it
soon after the 4.0 release.


Posted on the users mailing list.