Re: Composable continuations and reset/shift

2022-11-18 Thread Marc Nieper-Wißkirchen
I also think that Racket's model is not helpful. Moreover, an empty inner parameterize "(parameterize () ...)" would be optimized away by Racket, so it also depends on optimization. We shouldn't compare it too closely with the traditional implementation of parameters through dynamic-wind, I think

Re: Composable continuations and reset/shift

2022-11-18 Thread Shiro Kawai
You're right. Racket also gives a:1 b:1 c:1. So in Racket, a new parameterization is made during the dynamic extent of reset, other parameterizations is also kept. But if no new parameterization occurs, the parameterization at the moment of reset is not kept. In srfi-226 ref impl, reset (or cal

Re: Composable continuations and reset/shift

2022-11-18 Thread Marc Nieper-Wißkirchen
Am Sa., 19. Nov. 2022 um 08:04 Uhr schrieb Shiro Kawai : > > Yup, that nested parameterize example gives different results. > Racket, Gauche-release: a:1 b:1 c:2 > Srfi-226 ref.impl. , Gauche-HEAD: a:1 b:1 c:1 Can you recheck? The nested parameterize (with the N parameterization inside reset) gi

Re: Composable continuations and reset/shift

2022-11-18 Thread Shiro Kawai
Yup, that nested parameterize example gives different results. Racket, Gauche-release: a:1 b:1 c:2 Srfi-226 ref.impl. , Gauche-HEAD: a:1 b:1 c:1 The Racket model is explainable with dynamic-wind setting/resetting dynamic values of specified parameters (and that's how Gauche-release handles them)

Re: Composable continuations and reset/shift

2022-11-18 Thread Marc Nieper-Wißkirchen
Am Sa., 19. Nov. 2022 um 01:04 Uhr schrieb Shiro Kawai : > > I'm inclined to the reference implementation behavior; the last example you > show seems very confusing, especially that the dynamic value of m retrieved > in seemingly the same dynamic environment (on the prompt) is affected by the >

Re: Composable continuations and reset/shift

2022-11-18 Thread Shiro Kawai
I'm inclined to the reference implementation behavior; the last example you show seems very confusing, especially that the dynamic value of m retrieved in seemingly the same dynamic environment (on the prompt) is affected by the parameterization of unrelated parameters. In general you wound't know

Re: Composable continuations and reset/shift

2022-11-18 Thread Marc Nieper-Wißkirchen
Am Fr., 18. Nov. 2022 um 22:12 Uhr schrieb Marc Nieper-Wißkirchen : > > At first sight, Racket's behavior looks strange (tested with 8.2): > > This expression > > (let ((m (make-parameter 0)) > (n (make-parameter 0))) > (define k > (parameterize ((m 1)) > (call-with-continuation-p

Re: Composable continuations and reset/shift

2022-11-18 Thread Marc Nieper-Wißkirchen
At first sight, Racket's behavior looks strange (tested with 8.2): This expression (let ((m (make-parameter 0)) (n (make-parameter 0))) (define k (parameterize ((m 1)) (call-with-continuation-prompt (lambda () (parameterize () ((call-with-composable-co

Re: Composable continuations and reset/shift

2022-11-18 Thread Marc Nieper-Wißkirchen
Here is an example using only the primitives: (let ((m (make-parameter 0))) ((parameterize ((m 4)) (call-with-continuation-prompt (lambda () ((call-with-composable-continuation (lambda (k) (abort-current-continuation (default-continuation-prompt-tag)

Re: Composable continuations and reset/shift

2022-11-18 Thread Shiro Kawai
Racket v8.6 behaves the same way. On Fri, Nov 18, 2022 at 9:29 AM Shiro Kawai wrote: > I used Racket v7.2, and here's the full transcription. I'm going to check > with the newest Racket. > > shiro@scherzo:~/src/srfi-226$ racket > Welcome to Racket v7.2. > > (require racket/control) > > (define

Re: Composable continuations and reset/shift

2022-11-18 Thread Shiro Kawai
I used Racket v7.2, and here's the full transcription. I'm going to check with the newest Racket. shiro@scherzo:~/src/srfi-226$ racket Welcome to Racket v7.2. > (require racket/control) > (define (print . xs) (for-each display xs) (newline)) > (define m (make-parameter 0)) > (define c #f) > (defi

Re: Composable continuations and reset/shift

2022-11-18 Thread Marc Nieper-Wißkirchen
Thanks for the report, Shiro! I have to investigate Racket's behavior. In 11.3.2 of the Racket reference, it says: "If a continuation is captured during the evaluation of parameterize, invoking the continuation effectively re-introduces the parameterization, since a parameterization is associated

Composable continuations and reset/shift

2022-11-18 Thread Shiro Kawai
It seems that there's a disagreement in how a delimited continuation captures dynamic environment, between Racket and srfi-226. Suppose the following code: ``` (define (print . xs) (for-each display xs) (newline)) (define m (make-parameter 0)) (define c #f) (define (foo) (parameterize ((m 1)