Now Gauche starts to support continuation marks natively (only the basic
srfi-157 is implemented and I'll expand it toward srfi-226).  So far as I
understood, continuation marks *is* the dynamic environment, without
revealing too much internal details, isn't it?
Previously, I managed various internal dynamic contexts (e.g. exception
handlers, parameters) by dynamic-wind; when a continuation is invoked,
before and after handlers work hard to restore the dynamic state.  Once I
reversed the design, that is, letting continuation frames to hold the tip
of the current dynamic environment chain and simply restore it when popped,
things seem to become a lot simpler.

On Tue, Oct 18, 2022 at 9:01 PM Shiro Kawai <shiro.ka...@gmail.com> wrote:

> Now I started seeing the source of my confusion.  The phrase "annotate the
> most recent continuation frame": I interpret it as modifying the most
> recent continuation frame to attach the annotation.  But it's not---I only
> need to keep the "current" dynamic list of marks, and when the next
> continuation frame is pushed, that continuation frame remembers the tip of
> the marks so that it will be restored when the frame is popped.
>
> It might be helpful to say "_effectively_ annotate the most recent
> continuation frame" to indicate that annotation doesn't really involve
> immediate direct connection between continuation frames and marks.
>
> If I understand "dynamically annotated", it is less likely that I would've
> thought with-continuation-marks could modify the existing continuation
> frames.  But it might be helpful to add a hint that continuation frames are
> immutable.
>
>
> On Sun, Oct 16, 2022 at 7:59 PM Marc Nieper-Wißkirchen <
> marc.nie...@gmail.com> wrote:
>
>> Am So., 16. Okt. 2022 um 12:35 Uhr schrieb Shiro Kawai <
>> shiro.ka...@gmail.com>:
>> >
>> > On Sat, Oct 15, 2022 at 10:41 PM Marc Nieper-Wißkirchen <
>> marc.nie...@gmail.com> wrote:
>> >>
>> >> Am So., 16. Okt. 2022 um 01:26 Uhr schrieb Shiro Kawai <
>> shiro.ka...@gmail.com>:
>> >>
>> >> The sample implementation does it by not gluing the last activation
>> >> record and the last set of marks to a continuation frame. This only
>> >> happens, conceptually, for older frames.
>> >>
>> >> In the example below, CONT conceptually contains the latest frame
>> >> without the continuation mark attached. Inside the evaluation of
>> >> `with-continuation-marks`, the current continuation has changed,
>> >> namely its latest frame has been replaced by one with a mark attached.
>> >
>> >
>> > I see that is how reference implementation works, but is it the only
>> interpretation of the spec?  Notably, the behavior of
>> with-continuation-marks replacing the latest frame is derived from the
>> current spec?
>> >
>> > Probably I was not understanding "dynamically annotated" correctly.
>>  Does it mean that the annotation of the latest frame is effective within
>> the dynamic extent of with-continuation-marks?
>>
>> Yes; this is what it is supposed to say.
>>
>> Continuation frames and continuations are effectively immutable.  If
>> (non-pure) mutation happens, I use language like "replace", "mutate",
>> or "modify".
>>
>> If you think it will make things more transparent, I will explicitly
>> add a sentence stating the immutability.
>>
>> Marc
>>
>

Reply via email to