[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Patch] definitions in when, unless, do as well as in cond- and ca

From: Maxime Devos
Subject: Re: [Patch] definitions in when, unless, do as well as in cond- and case-clauses
Date: Thu, 17 Jun 2021 11:06:37 +0200
User-agent: Evolution 3.34.2

Linus Björnstam schreef op wo 16-06-2021 om 21:11 [+0200]:
> Hi there!
> This patch updates some derived conditional forms (and do and and-let*)
> to support definitions in expression context. Meaning it makes this valid 
> code:
> (cond 
>   ((pred? arg) 
>     (define a (something arg))
>     (when (error-case a)
>       (error "a is broken"))  [...]

This seems a useful change to me. However, this is not valid R6RS.
From <>:

(cond hcond clause1i hcond clause2i . . . ) syntax
=> auxiliary syntax
else auxiliary syntax
Syntax: Each hcond clausei must be of the form
(htesti hexpression1i . . . )
where htesti is an expression. Alternatively, a
hcond clausei may be of the form
(htesti => hexpressioni)

This seems a compatibility pitfall, so maybe note
in the documentation that using definitions in the clauses
is a Guile and Racket extension and not standard R6RS?

(I try to write Scheme code as R6RS / R7RS library & define-library
forms, importing mostly R6RS / R7RS & SRFI libraries, though I occasionally
use a Guile extension.)


Attachment: signature.asc
Description: This is a digitally signed message part

reply via email to

[Prev in Thread] Current Thread [Next in Thread]