Re: Python gets macros - now XML does too

From: jayessay (nospam_at_foo.com)
Date: 01/05/05


Date: 05 Jan 2005 17:41:47 -0500

Manuel Lemos <mlemos@acm.org> writes:

> Hello,
>
> on 12/18/2004 08:08 PM Frank Buss said the following:
> > I think the main advantage: You use Lisp within a Lisp macro to
> > generate Lisp code. I don't know how your system handles this (this
> > was one reason, why I asked you to provide a translation of my
> > simple example, to learn how your system works), but I think it is
> > cumbersome to implement the code generation part in another language
> > than the description to generate the code.
>
> MetaL compiler flow module provides support for level 0 (macro
> expansion) metaprogramming but IMO that is a very limited form of
> metaprogramming.
>
> Unless I misunderstood anything about LISP macros, it is not even
> unique to LISP. C has support for macros via the preprocessor, C++ has
> template classes and Java now has generics. There is no point in
> comparing the capabilities of each language macro expansion
> capabilities because that is not the topic here.

You have indeed misunderstood basically _everything_ about what Lisp
macros are and what capabilities they provide. They do not operate on
text, but on the preparsed syntax trees derived from the textual
input. There is actually nothing in MetaL that you can't do with Lisp
macros, if for no other reason than you could implement MetaL _as_ a
Lisp macro(s).

> The real power comes from level 2 metaprogramming features and
> eventually beyhond. Level 2 means that you write a code specification
> in an high level syntax. That that specification is translated into

This sort of thing is done all the time with Lisp macros. In fact
that is probably their main use, i.e., defining and implementing
domain specific languages. These, of course, provide for very high
level syntax for the description of terms, problems, and solutions in
the language of the domain.

/Jon

-- 
'j' - a n t h o n y at romeo/charley/november com


Relevant Pages

  • Re: Two questions together
    ... How powerful are the macros? ... > "programmable language" and as far as I know this feature is provided ... It is also said that one can hammer the Lisp so that ... I really love Lisp's syntax:) But I just want ...
    (comp.lang.lisp)
  • Re: macro for shorter array syntax
    ... How is OCaml on adding readmacros, which Lisp can do easily. ... I would not ask that of a parsed language. ... We're confident that using macros is useful to us, ... debate has legitimate points on both sides. ...
    (comp.lang.lisp)
  • Re: A "killer" macro
    ... but then Ruby is dog slow anyway: ... Having notational convenience via macros plus efficiency is a big win ... From my perspective as a Ruby programmer learning Lisp, ... thought of having a more powerful language *and* orderof magnitude ...
    (comp.lang.lisp)
  • Re: A "killer" macro
    ... Or perhaps Lisp doesn't have one thing ultra- ... with a prefix language. ... the only thing that *really* sets Lisp apart is macros. ... Ruby and C# are very different. ...
    (comp.lang.lisp)
  • Re: macro for shorter array syntax
    ... reason I turned to Lisp is that many, or even most, people in the C++ ... it is also a good idea to be careful with adding new macros. ... Hence an ideal language for implementing an interpreter for Simulink models would allow one to define block types directly, like e.g. so: ... So the actual implementation of the functionality provided by define-node-type is mostly achieved through functional libraries, MOP hackery, etc., and it is indeed still possible to define new node types by hand via defclass, defmethod and various globally-defined macro helpers, but a node definition is much more concise. ...
    (comp.lang.lisp)