Re: Bug report

[email protected] Mon, 17 Jan 2011 11:06:29 -0500 (EST)
Newsgroups gmane.lisp.scheme.scheme48
Message-ID <30604964.281451295280389917.JavaMail.root@zimbra>
Emmanuel Medernach wrote:

> I have a bug to report with the last Scheme48 build ( 1.8 )
> The following macro generates an error :
> 
> (define-syntax foo
>  (syntax-rules ()
>    ((foo (a ...) (b ...))
>     (list (list a b ...) ...))))
> 
> However it works fine with other Scheme implementations:
> (foo (1 2 3) (4 5)) => ((1 4 5) (2 4 5) (3 4 5))

It works fine in MzScheme v4.1.4, Ikarus 0.0.3, Ypsilon 0.9.6-update3,
and in Larceny's R6RS and ERR5RS modes, but Larceny's R5RS mode
accepts your definition of foo while rejecting your use:

> (foo (1 2 3) (4 5))
ERROR detected during macro expansion:
Use of macro is not consistent with definition
(#((v) b 1) #((v) a 1))
((4 5) (1 2 3))

The point of that peculiar error message is that meta-variable
a and b get bound to lists of different lengths.  That may be
a bug in Larceny's R5RS macro expander, but the R5RS discussion
of this is too vague to tell for sure.

On this point, it appears that the R6RS is even vaguer than the
R5RS; in practice, the semantics of R6RS macro expansion is
defined by the macro expanders of R6RS-compatible systems.  All
four of those macro expanders seem to accept your foo macro and
your (foo (1 2 3) (4 5)) example.

Will