[Prev][Next][Index][Thread]
Re: with-foo ( foo = args ) (was Re: Critique this macro, please)
Chris Page wrote in message ...
>in article ehp14t4jk5j5qu8f13m1gslni40q07j05t@4ax.com, Jason Trenouth at
>jason@harlequin.co.uk wrote on 2000.12.20 9:36 AM:
>
>> with-file-sequence ( file = "foo.txt", delimiter: '\n' )
>
>By the way, anybody know why "=" was chosen for this idiom? It seems a
>little misleading to me, especially in the simple case of one argument,
>since the arguments aren't being assigned to foo. I can see why "=" is
>appealing here, to highlight that foo will be assigned to, but it seems to
>me something else might make more sense here, like "in", "from", "<=" or
>perhaps something slightly more radical like:
I think I may have started this convention when I spec'ed
the streams library. The '=' is meant to indicate that the
thing to the left is being bound. It's not perfect, but it's
better than any alternative I could think of. Including, in
my opinion, your worthwhile attempt.
(What I don't like about your try is that '<=' doesn't really
look like a bind operation to me, and the naked parentheses
to it's right look, well, naked.)
> with-file-sequence file <= ( "foo.txt", delimiter: '\n' )
>
>Although I don't think Dylan can handle a macro with this syntax, and
anyway
>this probably reads incorrectly, implying that "file" is a file-sequence,
>but I think it helps separate the binding from the arguments better.
>
>--
>Chris Page
>
>let mailto = concatenate( "page", "@", "best.com" );
>
References: