[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-janitors] #1351: syntax-rules has difficulty handling ellip
From: |
Chicken Trac |
Subject: |
Re: [Chicken-janitors] #1351: syntax-rules has difficulty handling ellipsis in some cases? |
Date: |
Fri, 10 Mar 2017 19:24:41 -0000 |
#1351: syntax-rules has difficulty handling ellipsis in some cases?
---------------------------------+--------------------------
Reporter: sjamaan | Owner: sjamaan
Type: defect | Status: new
Priority: major | Milestone: someday
Component: expander | Version: 4.12.0
Resolution: | Keywords: syntax-rules
Estimated difficulty: hard |
---------------------------------+--------------------------
Comment (by sjamaan):
Another interesting case for which we should probably give an error, but
we silently return the wrong result:
{{{
(define-syntax foo
(syntax-rules ()
((_ (x ...) ((y ...) ...))
'(print (x y ...) ...))))
(foo (1 2) ((a b) (c d) (e f))) => (print (1 a b) (2 c d))
}}}
Racket and Guile give an error when you try to invoke this macro, Chibi
and Gauche fail exactly in the same way as we do.
It looks like this is due to how "map" works: It doesn't (always) check
the list lengths, it either stops on the shortest list (giving this
comment's problematic behaviour) or it gives an error that the lists
aren't the same length (giving the error in the ticket body).
Before walking the macro's invocation expression the lists should be
checked for length, so we can give a nicer error, and avoid silently
dropping lists. However, that won't solve the problem in the ticket body
that it is generating the "wrong" expression, for some value of wrong.
--
Ticket URL: <https://bugs.call-cc.org/ticket/1351#comment:2>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.