[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:
>
>    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.


[I tried to post a reply once, but it may have gotten dropped.
Apologies if this is a duplicate.]

I think you can blame me for '=' in this sort of thing.  It's what I
chose for the macros in the Streams library, which was the
first standardized non-core library.  I chose this because it
seemed the most evocative of a binding operation.

I considered other syntaxes, but settled on this as the simplest.

I don't like yours for two reasons:
 - '<=' doesn't say "bind" to me
 - the naked parens after the '<=' look too, well, naked

It's probably not worth tweaking this convention at this point,
since all the Fun-O de facto "standard" libraries now use it...





References: