On Thu, May 23, 2024 at 4:25 PM Damien Mattei <damien.mat...@gmail.com> wrote: > On Thu, May 23, 2024 at 12:37 AM Jeronimo Pellegrini <j...@aleph0.info> wrote: >> On 2024-05-22 18:07, Pierpaolo Bernardi wrote: >> > In chez: >> > >> >> (cond (else (define x 7) x)) >> > 7 >> >> x >> > 7 >> > >> > which looks like a bug to me.
> yes i spent many hours debugging to understand why > (cond (else (define y 7) y)) worked and not (cond (#t (define x 7) x)) I had and explanation from Jamie Taylor. The implementations which behave like Chez, are probably using the example definition of the cond syntax given in appendix B of the R6 report, which expands (cond (else result1 result2 ...)) into (begin result1 result2 ...). Given the splicing nature of begin, when the cond is in a context valid for definitions we have the weird result above. https://github.com/cisco/ChezScheme/issues/835