[r6rs-discuss] Continuations and expansion

From: AndrevanTonder <andre>
Date: Tue, 24 Jul 2007 19:28:54 -0400 (EDT)

On Tue, 24 Jul 2007, David Van Horn wrote:

> The following program captures and invokes continuations during
> expansion. I would expect the program to evaluate to #t, which is the
> result according to Andre van Tonder's portable expander, but is this
> behavior specified in the current draft? My impression is yes,
> although I'd like to make sure.

Good question. Maybe one of the other implementors can check if they
get the same result. I am not sure if or how this kind of thing might
interfere with the suggested mark-antimark algorithm, which I do not use.

I am not even sure if this kind of thing is guaranteed to always work even
with my expander, since I do have some uses of global state. So if a
user macro transformer is allowed to return twice, I supect (but cannot say
for certain right now) that inconsistencies might occur.

For this reason, it might have been a good idea to include a statement in the
draft to the effect that the result of returning more than once from a
transformer invocation is unspecified.

> (syntax-let/cc k
> (begin
> (syntax-invoke/c k #t)
> (let)))

I do not think this can be portable as is, since the expansion order of
expression-begin sequences is not specified as far as I know. On the
other hand, if you replace (BEGIN ---) by (LET () ---), then the question
remains open.

Cheers
Andre
Received on Tue Jul 24 2007 - 19:28:54 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC