[plt-scheme] Are macros a programming language?

From: David Einstein (deinst at gmail.com)
Date: Sun Oct 21 13:56:53 EDT 2007

On 10/21/07, Grant Rettke <grettke at acm.org> wrote:
> On 10/21/07, Carl Eastlund <cce at ccs.neu.edu> wrote:
> > Why aren't they Scheme?
> My thought was that it generates Scheme, but it is not Scheme.
> For example I wanted to iterate over a list of arguments. I couldn't
> (which only means I don't know how not that it is impossible) just
> iterate over the n-ary arguments and emit the desired code.
> I ended up recursively matching patterns to perform iteration (though
> Chongkai Zhu showed me a nicer way); the iteration didn't look like
> Scheme:

Macro expansion does not look like scheme in many ways.  One that has
bitten me more than once is that the order of evaluation is different:
in normal scheme (foo (bar baz))  will call bar and pass the result on
to foo, while as macros foo will be expanded, and then bar, if it
remains in the expansion of foo will be expanded.

One can, like Carl, consider it as an integral subset of scheme, but
no harm is caused by considering it as a separate language

> ((_ name)
>      (begin
>        (if (not (identifier? (syntax name)))
>            (raise-syntax-error
>             #f
>             "property names must be identifiers, not expressions"
>             (syntax name)))
>        (syntax
>         (begin
>           (define property-name null)
>           (define/public name
>             (case-lambda
>               [() property-name]
>               [(value) (set! property-name value)]))))))
>     ((_ name names ...)
>      (syntax
>       (begin
>         (property name)
>         (property names ...))))))
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.