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

Re: Improper lists in macros [WAS: none]



Regarding if (foo 1 . (2)) is a valid expression


I'm sorry that this remark has nothing to do with SRFI-26 per se. I'd
only like to point out that this topic has been discussed before, in
some interesting detail.

One thread:
http://groups.google.com/groups?hl=en&frame=right&th=b91405fdd9d49df7&seekm=8vca7q%2422g%241%40news3.bu.edu#link8

specifically:
http://groups.google.com/groups?hl=en&frame=right&th=b91405fdd9d49df7&seekm=zoikf3u6.fsf%40content-integrity.com#link26

And another thread:

http://groups.google.com/groups?hl=en&threadm=k8a3spk3.fsf%40content-integrity.com

It seems Joe Marshall shared Mike's position: the spirit of
R5RS ought to allow expressions like "(foo 1 . (2))". However, Joe Marshall
conceded that a compliant implementation has every right to refuse to
accept (foo 1 . (2)), however foo is bound (to a procedure or to
a syntax transformer). Therefore, when Gambit says

> (+ 1 . (2))
*** ERROR IN (stdin)@1.1 -- Ill-formed procedure call 
> (define-macro (foo . x) #f) 
> (foo 1 . (2))
*** ERROR IN (stdin)@4.1 -- Ill-formed special form: foo

it is being compliant. BTW, the following does work:

> (define-macro (bar . x) `',x)
> (bar 1 2)
(1 2)
> (bar (1 . 2))
((1 . 2))
> (bar (1 . (2)))
((1 2))