This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

re-write of Kawa macro handling


I just checked into CVS a major re-write of the macro-handling
and hygiene framework. (This is largely sponsored by Marced Systems.)
The big idea is that expanding a syntax template creates
"syntax objects" (implemented using the SyntaxForm class).
The syntax object carries with it the syntatic environment
Therefore we don't have to rename symbols, which caused
problems with quoting.  (Savannah bug 10561 is now fixed.)

We now have usable support for syntax-case; in fact some of the
primitives (such as 'if') are now implemented using syntax-case.
(syntax FORM) (or the short-cut #!FORM) evaluates to a syntax object.
(define-syntax (mac x) tr) same as (define-syntax mac (lambda (x) tr))
The following non-hygienic forms are equivalent:
  (define-macro (MACRO-NAME (PARAM ...) TRANSFORMER)
  (define-macro MACRO-NAME (lambda (PARAM ...) TRANSFORMER))
  (defmac MACRO-NAME (PARAM ...) TRANSFORMER)
Allow vectors and more general ellipsis-forms in patterns and templates.

And a bunch of macro-related bugs have been fixed.

Please check it out.  I'm know there are bugs remaining.
Unfortunately, there is a lot of tedious working fixing the
primitive syntax forms to handle SyntaxForm correct.  That's
one reason why I'm converting some of them to be defined as
syntax-case macros.

There is one seeming regression in the testsuite, where we get a
warning that the compiler can't find a constructor (for essentially
an inner Scheme class).  This is not a change in the compiler, but
because the new code generates a lot of extra 'let' scopes, which
prevents interpretation.  In addition to fixing teh compiler so it
*can* find the constructor, one fix is to allow the interpreter
to handle lexical scopes.  We want this anyway, to handle lexically
nested syntax-case macros, uses in let-syntax/letrec-syntax, or
used in the same module as they're defined.

Another regression is that we lose line number information in a few,
which might make error messages and stack traces less helpful.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]