SYNTAX-RULES literal matching

Matthew Dempsky <[email protected]> 06 Mar 2004 21:04:45 -0600
Newsgroups gmane.lisp.scheme.pika.devel
Message-ID <[email protected]>
Tom,

Apparently I was (at least partially) mistaken in my understanding of
literal matching for SYNTAX-RULES macros in R5RS:

	Identifiers that appear in <literals> are interpreted as
	literal identifiers to be matched against corresponding
	subforms of the input. A subform in the input matches a
	literal identifier if and only if it is an identifier and
	either both its occurrence in the macro expression and its
	occurrence in the macro definition have the same lexical
	binding, or the two identifiers are equal and both have no
	lexical binding.

For the most part, this seems like it wouldn't mandate that modules
export bindings for literals that refer to the top-level in the
definition environment, however, something like

    (let ((else #f))
      (let-syntax ((cond (syntax-rules (else)
                           [as defined in r5rs])))
        (eval some-code (make-module (the-environment)))))

seems like an issue where some-code uses the defined COND form along
with the ELSE clause: in the SYNTAX-RULES definition, ELSE has a
lexical binding and in evaluating some-code we would have to do some
icky magic to get it to do the Right Thing (unless I'm mistaken on
what the Right Thing is).

-jivera