On 17 Sep 2009, at 8:57 pm, John Cowan wrote:

> If I had my druthers, all programs would begin with syntax-rules
> macros
> (possibly zero of them) at the top, and the rest of the code would use
> those extensions and not be able to add any more new syntax.

*nod* there's advantages to that; whenever you limit expressiveness,
it becomes easier to read programs (both for humans and computers)...
at least at a trivial level ;-)

In effect, you're not all *that* keen on macros, I guess. I certainly
agree that it's easy to overuse them; certainly, any problem that can
be well solved with only higher-order functions and other such tools
should be, rather than going to macros (which aren't first-class, for
a start).

But I'm interested in PL research; I'd quite like to write entire new
languages as Scheme macros whose expanders are basically a "compiler
into Scheme", so that I can embed them in Scheme code and intermingle
them, thereby using whatever language is best for the problem at hand.
syntax-rules is great for your simple shorthand "when/unless" macros,
and can be bent to more complex macros with a little ingenuity, but
reaches its limitations when you want to express "real algorithms".
Again, I'd say "use syntax-rules where possible as it's simpler for
everyone", but it's not always enough.

What does this mean for us, at an impasse arguing about what the
correct level of power (and, thus, burden of responsibility) to give
the programmer?

Give them options!

Why not define a simple module/program defining form that does exactly
what you say - define a bunch of syntax-rules macros, then a bunch of
begins that go into an implicit letrec, then a bunch of expressions.
And so simple implementations could just provide that, and have real
simple handling of scope/visibility.

And define an optional feature of a more complex one that lets you do
crazy stuff (and implements the simple one as a no-op macro expanding
to it, pretty much).

ABS

--
Alaric Snell-Pym
Work: http://www.snell-systems.co.uk/
Play: http://www.snell-pym.org.uk/alaric/
Blog: http://www.snell-pym.org.uk/archives/author/alaric/




_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to