Errata for SRFI 5 Philip McGrath (19 Jan 2022 21:45 UTC)
Re: Errata for SRFI 5 Philip McGrath (20 Jan 2022 04:09 UTC)
Re: Errata for SRFI 5 Arthur A. Gleckler (20 Jan 2022 04:52 UTC)

Re: Errata for SRFI 5 Philip McGrath 20 Jan 2022 04:09 UTC

On 1/19/22 16:44, Philip McGrath wrote:
 > Hi,
 >
 > (I'm sending this to srfi-discuss as well as the srfi-5 list, since the
 > last message there is from 2005, and the last real discussion from 1999.)
 >
 > I believe I have found some errata and ambiguities in SRFI 5.
 >

P.S. A fourth point of ambiguity is that the SRFI 5 specification does
not say whether this expression:

--8<---------------cut here---------------start------------->8---
(let x ((x 1)) x)
;; or, equivalently:
(let (x (x 1)) x)
--8<---------------cut here---------------end--------------->8---

ought to evaluate to `1` or a procedure, or if there should be a syntax
violation.

The remark at the beginning of
<https://github.com/scheme-requests-for-implementation/srfi-5/blob/ead1ea67b3a5746d640afc70fd2a09422450cea0/srfi-5.html#L137-L160>:

--8<---------------cut here---------------start------------->8---
<H2>Syntax</H2>

<p>
A formal specification of the syntax follows.  Below, body, expression,
and identifier are free.  Each instantiation of binding-name must be
unique.
</p>

<p>
<pre>
             let = "(" "let" let-bindings body ")"
     expressions = nothing | expression expressions
    let-bindings = let-name bindings
                 | "(" let-name "." bindings ")"
        let-name = identifier
        bindings = "(" ")"
                 | rest-binding
                 | "(" normal-bindings ["." rest-binding] ")"
normal-bindings = nothing
                 | normal-binding normal-bindings
  normal-binding = "(" binding-name expression ")"
    binding-name = identifier
    rest-binding = "(" binding-name expressions ")"
</pre>
--8<---------------cut here---------------end--------------->8---

doesn't answer the question, since `let-name` is not an "instantiation
of binding-name".

In fairness, R5RS doesn't seem to specify the answer for `(let x ((x 1))
x)`, either: for RNRS `let`, Chez Scheme 9.5.6 and Racket 8.3 in `#lang
r5rs` both say `1` (i.e. the `binding-name` shadows the `let-name`), but
Guile 3.0.5 raises a syntax error.

I have checked the sample implementation of SRFI 5 against those
versions of Chez, Guile, and Racket, and all---even Guile---agree that
the `binding-name` shadows the `let-name`. (This is true regardless of
the option chosen for `standard-let`, since that isn't used in this case
anyway.)

I suggest that other implementers of SRFI 5 maintain this behavior for
compatibility.

-Philip