Re: cond clause does not allow definitions

Linus Björnstam <[email protected]>
Newsgroups gmane.lisp.guile.user
Message-ID <[email protected]>
I submitted a patch that expanded definition context to more places (cond, case, when, unless etc). I dont know what happened to that. I submitted it while moving and promptly forgot about it after some discussion.

-- Linus Björnstam

On Wed, 22 May 2024, at 21:26, Damien Mattei wrote:
> scheme@(guile-user)> (cond (#t (define x 7) x))
> While compiling expression:
> Syntax error:
> unknown file:7:10: definition in expression context, where definitions are
> not allowed, in form (define x 7)
>
> but it is allowed in else clause:
> scheme@(guile-user)> (cond (else (define x 7) x))
> $4 = 7
>
> not really logic
>
> it is allowed in Kawa and Racket but they are not scheme references
> the R5RS and R7RS talk about 'clause' without more information
>
> is it normal for Guile to consider clause for cond to be an expression
> context and not a definition context?
>
> should not be better to consider definition context? that would allow more
> possibilities.
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.