[racket] Flatten syntax and runtime phases?

From: Nick Sivo (nick at kogir.com)
Date: Fri Jul 13 14:05:24 EDT 2012

> Heh -- this is very nice to hear, since Arc is supposed to be using
> macros in a way that highlights unhygienic macros...

My take on it is that Arc's original macros were designed to be
powerful but simple.  All you need to know in order to use them are
the language primitives and any functions and macros you've defined.
There were only a few places where breaking hygiene was a feature, and
those weren't really given any special attention.

In comparison, syntax-case and syntax-parse macros require the user to
learn much more before using them[1], and they require fancier tricks
to group arguments into pairs[2], or to expose an unhygienic binding.
They also don't allow you to use a function you just defined in phase
0 as part of the macro processing, something which initially threw me
for a loop. Arc's macros had warts (w/uniq), but their simplicity
played right into my naive expectations - I was never surprised, and
never needed to consult documentation.

Anyway, I'm too new to Lisp, Racket and Arc to have any real opinion
here.  I'm just trying to make Arc faster, and targeting Racket more
directly has been beneficial in getting there.

-Nick

[1] phases, syntax objects, syntax properties, syntax classes, syntax
parameters, etc.

[2] Arc regularly processes macro arguments as lists, which are very
straightforward and familiar. To pair things, just take two at a time
until there's one or none left.  You can accomplish the same with
multiple syntax-case cases or a syntax-parse syntax class or head
pattern, but neither of those are how you'd do it in a function-
they're macro specific.

On Thu, Jul 12, 2012 at 5:20 PM, Eli Barzilay <eli at barzilay.org> wrote:
> On Wed, Jul 11, 2012 at 7:53 PM, Nick Sivo <nick at kogir.com> wrote:
>> After fighting with defmacro for a while I ended up abandoning it and
>> implementing what I need with syntax/parse instead. This requires
>> re-writing the arc macros, but that isn't all bad since their new
>> forms are generally shorter, clearer, and benefit greatly from
>> hygiene. [...]
>
> Heh -- this is very nice to hear, since Arc is supposed to be using
> macros in a way that highlights unhygienic macros...
>
> --
>           ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                   http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.