Re: cond clause does not allow definitions

Pierpaolo Bernardi <[email protected]>
Newsgroups gmane.lisp.guile.user
Message-ID <CANY8u7E=0DE-+a44LnLzsAYf1arTAfdrj_YwGGuUXVaC7tsoog@mail.gmail.com>
On Thu, May 23, 2024 at 4:25 PM Damien Mattei <[email protected]> wrote:
> On Thu, May 23, 2024 at 12:37 AM Jeronimo Pellegrini <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.