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

Re: How many arguments to a macro transformer?

This page is part of the web mail archives of SRFI 72 from before July 7th, 2015. The new archives for SRFI 72 contain all messages, not just those from before July 7th, 2015.

Keith Wright wrote:

 > The short form is wonderful; we should keep it just as it is.
 > (1) It is not possible to make the relation of long form to short
 > form for |define-syntax| exactly parallel to that for |define|
 > without major changes to the language.  Given that they must be
 > different, it is less likely to cause confusion if the difference
 > is large.
 > (2) It is a long tradition that a macro has one argument which is
 > bound to the entire form of the macro call.  I think that both
 > LISP 1.5 and Common Lisp do it that way.
 Thank you - more good reasons supporting the current choice.  
 > The appendix of R4RS says that it has been suggested (it doesn't
 > say by whom) that #'<datum> and #`<datum> would be felicitous
 > abbreviations for (syntax <datum>) and (quasisyntax <datum>).
 > Could this be added to the SRFI?
 I will add that as a recommendation in the next revision.
 > Since |syntax| is already analogous to |quote|, is |syntax-quote|
 > really the right name for the third way?  If I understood it
 > better, I might be able to name it better.  How about
 > |syntax-reuse|?
 Good point.  Another possibility could be |syntax-verbatim|.  
 I'm also considering dropping this one, since it can be defined as a macro
 (although admittedly a rather ugly macro involving a compile-time
 data structure - hmm).     
 > As a stylistic matter, I think it would be better to remove uses
 > of |syntax-case| and |with-syntax| from the examples, except
 > where comparison with |syntax-case| is the point of the example.
 > In particular, the example given under the description of
 > |syntax-quote| is confusing because it requires a rather deep
 > understanding of |syntax-case| in order to follow.  A better
 > example would be built out of the the forms defined by the
 > SRFI only.  I bet it would actually come out shorter that
 > way, but I won't venture to try to make the example this
 > close to midnight.  It would also help to have two examples,
 > identical except that one uses |syntax| and the other
 > uses |syntax-quote| with different results.
 Since |syntax-case| is included in the new revision,
 it is probably okay to use it in examples where the pattern
 matching makes things clearer.  Where it doesn't, as in the |syntax-quote|
 example you raise, I'll work on rewriting them.    
 By the way, my justification for including the |syntax-case| form, even 
 though it is not a primitive, has not been well documented yet.  
 So here goes:  
   * I am specifying an improvement in the semantics of syntax-case
     for better hygiene.
   * A proposal that does not come with some form of pattern matching 
     won't be regarded as usable by many Schemers.  
   * For R5RS compatibility, we need to provide syntax-rules.  
     Syntax-case implies syntax-rules, and since the implementation 
     of syntax-case is only a few lines longer than that of syntax-rules,
     the implementation cost of including syntax-case is negligible.   

 > The link to Andrew Wright's pattern matcher
 >  http://download.plt-scheme.org/.../match.ss
 > at the end of kffd-match-tut.htm seems to be broken.
 Thank you - I removed it.