Hi Tassilo,

On Tue, Dec 06 2011, Tassilo Horn wrote:

> "Jose A. Ortega Ruiz" <j...@gnu.org> writes:
>
> Hi Jose,
>
>>> I think that Common Lisp macros are, strictly speaking, more powerful
>>> than Scheme macros, but I don't have a citation.
>>
>> That's only true for syntax-rules macros.  syntax-case macros, which
>> most schemes provide and are required by R6RS, are, strictly speaking,
>> more powerful than CL macros.
>
> I don't know scheme macros, so could you please explain why they are
> more powerful?  What can you do with a syntax-case macro what you cannot
> do with a Common Lisp (or Clojure) macro?

In general, syntax-case lets you manipulate first-class syntax objects,
whereby all kind of neat tricks are possible out of the box.  You gain
in expressivity.  This is a good overview:

  http://blog.racket-lang.org/2011/04/writing-syntax-case-macros.html

> Wikipedia lists syntax-case as hygienic macro system, which would make
> it less powerful than CL macros, because if that was true, you could not
> write anaphoric macros with it.

It's hygienic by default, but offers ways of breaking hygiene.  As a
matter of fact, it's possible to define defmacro using syntax-case (see, e.g.,
https://mercure.iro.umontreal.ca/pipermail/gambit-list/2007-March/001195.html),
and then you can use defmacro in Scheme too :)

It's also possible to implement hygiene on top of defmacro (with the
help of CLOS's symbol-macrolet:
http://www.p-cos.net/documents/hygiene.pdf), but it's much more
convoluted (and, IIRC, some of the syntax API is still missing in that
long paper).

Even if you don't buy the expressivity argument, i think we can agree
that syntax-case macros are, at least, as powerful as CL macros.

Cheers,
jao
--
Humans think they are smarter than dolphins because we build cars and
buildings and start wars etc., and all that dolphins do is swim in the
water, eat fish and play around. Dolphins believe that they are
smarter for exactly the same reasons. -Douglas Adams

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to