Re: Does continuation marks take a snapshot? Marc Nieper-Wißkirchen 15 Oct 2022 22:22 UTC

Am Sa., 15. Okt. 2022 um 13:25 Uhr schrieb Shiro Kawai <xxxxxx@gmail.com>:
>
> Just to be sure.  In the following code, the returned mark set contains the key-value pair {key, mark1} but not {key, mark2}, correct?

Continuation marks are attached without mutation like when you cons to a list.

In the example below, CONT captured by call/cc does not include any of
the marks set by the code so the returned mark set neither contains
any key-value pair of the two.

>
> ===
> (let ((marks #f))
>   (call/cc
>    (lambda (cont)
>      (with-continuation-marks 'key 'mark1
>        (begin
>          (set! marks (continuation-marks cont))
>          (with-continuation-marks 'key 'mark2 #f)))))
>   marks)
> ===
>
>