Re: macro for shorter array syntax
- From: Dan Bensen <randomgeek@xxxxxxxxxxxxxx>
- Date: Sat, 19 May 2007 01:15:37 -0500
Jon Harrop wrote:
I thought this was a trivial OCaml macro but it is apparently prohibitively
difficult to translate into Lisp.
The closest so far seems to be Pascal's:
which doesn't handle operator associativities and precedences.
This implies that OCaml macros can be easier which, in turn, justifies my
point about macros not being useful in languages that provide non-trivial
syntax.
I think some of the disagreement here is over the word "syntax". When
Lisp manuals and tutorials say macros define new syntax, they're usually
talking about the overall structure of the program, where WITH-macros
automatically allocate and deallocate resources, DO- macros implement
loops, etc.. What they never seem to mention is that almost all of this
syntactic transformation occurs within the standard sexpr convention.
Macros are not usually used for character twiddling, they're used
primarily to encapsulate program organization at a larger scale.
When I first read about Lisp macros, I also thought the manuals were
talking about character twiddling, and I was disappointed to find that
the manuals had glossed that over. I didn't mind so much that macros
weren't as good for going beyond sexpr syntax as for working within it,
it's just that it would have been nice if the manuals could have
explained that more clearly. That's what manuals are for: They're
supposed to explain things. If they don't do that, they're not doing
their job.
The same thing goes for experienced Lispers chatting on internet
newsgroups. Lisp is not optimized for trivial little exercises,
and yet we insist that it's just as good for character-twiddling
exercises as other languages with those features built in. I don't
think it is. I think some of the modern functional languages have
lots of sugary syntax and are very good at defining new forms of
syntax with even more sugar. The question for large-scale pro-
fessional software development is whether low-level sugar is more
important than encapsulating huge swaths of the entire program.
Would Camlp4 be good for implementing something like LOOP or CLOS
if someone really wanted it? Would it be good for implementing
something like Viaweb or any number of AI applications?
Even though this thread is here on c.l.l, we're allowing the conver-
sation to drift away from lisp-related subjects, while at the same
time denying that fact. No, Lisp macros are not optimized for low-
level character juggling. They're designed for more important things,
and we should stop insisting otherwise. All it does is provide food
for trolls and other people who wonder why they can't have their
favorite form of syntactic sugar and have no idea of the even more
useful features they're missing out on.
--
Dan
www.prairienet.org/~dsb/
.
- Follow-Ups:
- Re: macro for shorter array syntax
- From: Jon Harrop
- Re: macro for shorter array syntax
- From: Raffael Cavallaro
- Re: macro for shorter array syntax
- References:
- macro for shorter array syntax
- From: Tamas Papp
- Re: macro for shorter array syntax
- From: Jon Harrop
- Re: macro for shorter array syntax
- From: Chris Russell
- Re: macro for shorter array syntax
- From: Jon Harrop
- Re: macro for shorter array syntax
- From: Chris Russell
- Re: macro for shorter array syntax
- From: Jon Harrop
- Re: macro for shorter array syntax
- From: Raffael Cavallaro
- Re: macro for shorter array syntax
- From: Jon Harrop
- Re: macro for shorter array syntax
- From: Raffael Cavallaro
- Re: macro for shorter array syntax
- From: Jon Harrop
- Re: macro for shorter array syntax
- From: Raffael Cavallaro
- Re: macro for shorter array syntax
- From: Jon Harrop
- Re: macro for shorter array syntax
- From: Kent M Pitman
- Re: macro for shorter array syntax
- From: Jon Harrop
- Re: macro for shorter array syntax
- From: Raffael Cavallaro
- Re: macro for shorter array syntax
- From: Jon Harrop
- Re: macro for shorter array syntax
- From: Jon Harrop
- macro for shorter array syntax
- Prev by Date: Re: Can you learn computer science from a school?
- Next by Date: Re: macro for shorter array syntax
- Previous by thread: Re: macro for shorter array syntax
- Next by thread: Re: macro for shorter array syntax
- Index(es):
Relevant Pages
|