Summary
Incomplete SRFI-46/R7RS tail pattern support
Metadata
- Id: 0142a306be4942b876760ccbbc50f3a6903d8a9b
- Trac id: 1736
- Type: defect
- Reporter: wasamasa
- Owner:
- Cc:
- Status: closed
- Component: core libraries
- Estimated difficulty:
- Resolution: fixed
- Priority: minor
- Milestone: 6.0.0
- Version: 5.2.0
- Changetime: 2023-11-13 13:04:55 UTC
- Created: 2021-03-27 11:17:46 UTC
- Keywords: syntax-rules srfi-46
Attachments
- 0142a306be4942b876760ccbbc50f3a6903d8a9b/attachments/test.scm
Description
I've run into an expansion error when trying to install (chibi optional). It's using a tail pattern of the (binding ... . rest) kind. SRFI-46 only shows one tail pattern example of the ((binding ...) . rest) kind, but R7RS is explicit about allowing both:
⟨transformer spec⟩ −→ (syntax-rules (⟨identifier⟩*) ⟨syntax rule⟩*) | (syntax-rules ⟨identifier⟩ (⟨identifier⟩*) ⟨syntax rule⟩*) ⟨syntax rule⟩ −→ (⟨pattern⟩ ⟨template⟩) ⟨pattern⟩ −→ ⟨pattern identifier⟩ | ⟨underscore⟩ | (⟨pattern⟩*) | (⟨pattern⟩+ . ⟨pattern⟩) | (⟨pattern⟩* ⟨pattern⟩ ⟨ellipsis⟩ ⟨pattern⟩*) | (⟨pattern⟩* ⟨pattern⟩ ⟨ellipsis⟩ ⟨pattern⟩* . ⟨pattern⟩) | #(⟨pattern⟩*) | #(⟨pattern⟩* ⟨pattern⟩ ⟨ellipsis⟩ ⟨pattern⟩*) | ⟨pattern datum⟩
According to SRFI-46 alexpander does support both patterns just fine, the error message originates from synrules.scm. I've attached a file with simplified examples for both the working and not working pattern. I've also done a brief check across R7RS-compliant Scheme implementations, it seems that Cyclone doesn't support it either, while Chibi, Kawa, Gauche, Sagittarius and Foment do.
Changes and comments
[2021-03-27 11:19:25 UTC] wasamasa attached test.scm (description=#f)
[2023-11-12 22:49:20 UTC] felix changed milestone from someday to 6.0.0
[2023-11-13 13:04:55 UTC] felix changed status from new to closed
[2023-11-13 13:04:55 UTC] felix set resolution to fixed
[2023-11-13 13:04:55 UTC] felix wrote:
Should work now in C6