[Prev][Next][Index][Thread]
Re: with-foo ( foo = args ) (was Re: Critique this macro, please)
-
To: info-dylan@ai.mit.edu
-
Subject: Re: with-foo ( foo = args ) (was Re: Critique this macro, please)
-
From: Chris Page <page@best.com>
-
Date: Fri, 5 Jan 2001 13:30:02 -0500 (EST)
-
Organization: SBC Internet Services
-
References: <91lbfr$pk2$1@nnrp1.deja.com> <13214touudcj9ma1dgtpa7kbar71r4ag2a@4ax.com> <ehp14t4jk5j5qu8f13m1gslni40q07j05t@4ax.com> <B6733EBA.5869%page@best.com> <GGv36.27094$1M.5921606@typhoon.ne.mediaone.net>
-
User-Agent: Microsoft-Entourage/9.0.2509
-
Xref: traf.lcs.mit.edu comp.lang.dylan:12951
in article GGv36.27094$1M.5921606@typhoon.ne.mediaone.net, Scott McKay at
swm@mediaone.net wrote on 2000.12.30 5:08 PM:
> I considered other syntaxes, but settled on this as the simplest.
Yes, I can see the advantage of simpler syntax. But I find it a bit odd to
put the binding name and the binding symbol within the parenthesis next to
the arguments.
> I don't like yours for two reasons:
> - '<=' doesn't say "bind" to me
> - the naked parens after the '<=' look too, well, naked
Well, that was just meant to evoke ideas on the topic. I'm curious what you
thought of the other possibilities, such as "in", which seems in line with
the "for" macro:
with-file-sequence( file in "foo.txt", delimiter: '\n' )
Perhaps the real problem here is restricting ourselves to ASCII. There might
be a much better symbol or symbols in Unicode, for example.
Here are some other ideas:
with-file-sequence file from( "foo.txt", delimiter: '\n' )
with-file-sequence file using( "foo.txt", delimiter: '\n' )
with-file-sequence file in "foo.txt", delimiter: '\n' do
(I kind of wish "for" had used a keyword like "do" to eliminate the
parenthesis.)
> It's probably not worth tweaking this convention at this point,
> since all the Fun-O de facto "standard" libraries now use it...
I think it's always worth thinking about how things might be improved, even
if a particular instance won't be changed in the foreseeable future.
In this particular case, I guess I'm interested in the larger question of
what constitutes good macro syntax. It seems to me that restricting macros
to lumping everything into a single list of items in parenthesis is overly
simplistic. Even in Lisp, the binding name and the arguments would probably
be separated into separate lists (this is a rough guess, I'm no Lisp
expert):
(with-file-sequence (file) ("foo.txt" :delimiter '\n')
or
(with-file-sequence ((file) ("foo.txt" :delimiter '\n'))
--
Chris Page
let mailto = concatenate( "page", "@", "best.com" );
Follow-Ups: