Re: Video on continuations, and call/cc-safe programming in the SRFI
Marc Nieper-WiÃkirchen 17 Aug 2022 19:58 UTC
Wouldn't it be enough to say that a "pure" (= "call/cc-safe"
procedure) is a procedure that behaves as if doesn't mutate any
location in the store?
The only locations visible by the rest of the program are those
created outside the "pure" procedure, the locations referenced by the
procedure's return values, and the locations referenced by the
arguments and continuation passed to its call-back arguments. So a
"pure" procedure must not change these locations (or, if it does so,
must reset them to their old values before control leaves its code).
Just saying that the locations captured by reifying the current
continuation are not mutated is not enough. On the other hand, the
above definition includes the captured stack.
Marc
Am Mi., 17. Aug. 2022 um 18:30 Uhr schrieb Bradley Lucier
<xxxxxx@math.purdue.edu>:
>
> https://www.youtube.com/watch?v=Ju3KKu_mthg
>
> This video, which was shared on the Scheme discord channel, explains how
> call/cc captures the state of the stack.
>
> I think that, in the language of the video, I changed the SRFI library
> code to ensure that, if the stack/continuation is captured, the library
> code doesn't change the state of the data on the captured stack (using
> set!, vector-set!, etc.).
>
> I figured that, instead of trying to say what "call/cc safe" means in
> general, I'd say how I changed the library code.
>
> Brad