[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PSL's FOR Macro
In the hopes of reviving some discussion, here's the last message
I saw and my long-delayed(I hate classes...) response:
>I think it would be great if a Common Lisp version of PSL's FOR macro were
>written and submitted to the Yellow Pages. I also think it would be great
>if there were a Yellow Pages at all!
How will we know when a Yellow Pages exists? Presumably it's not enough
for a random person to declare that it exists and that contributions are
encouraged and will be made available to the world...
>I personally would never use this macro if I had an alternative, primarily
>because of the fixed order of evaluation, which means that you can write code
>that looks like it will be evaluated in a certain order, but actually it
>will be evaluated in a different order, causing subtle bugs.
PSL's FOR macro is definitely too limited to inflict on the world.
The fixed order of evaluation does not seem to cause bugs (at least
it never has for me) - in fact you might get more subtle bugs when
two clauses interact in different ways depending on their relative
order. Fixed order of evaluation just means you have to *know* how
it will be expanded. Once upon a time I thought that having a
fixed processing order for LOOP might help a compiler, but I've
never been able to think of a real example. Making LOOP process
clauses in the order specified in the source is fine with me (assuming
the clauses can be defined not to have really bizarre effects when
in unexpected relations).
>I also find the
>syntax less readable than the syntax of LOOP, but that of course is more a
>matter of personal taste than of anything that a group could agree on.
The most important consideration for LOOP syntax should be consistency, the
second most important, readability. LOOP is in a rather anomalous
position. Its syntax, while keyword-based, cannot be the same as that
used for function keywords - (loop :with foo bar baz ...) associates
three "arguments" with a single keyword. The alternative of having a
single keyword used normally several times as in (loop :with foo :with bar ...)
is also inconsistent with function keywords (not to mention ugly).
Keywords plus parens seems unnecessarily redundant, but there is
precedent; the defstruct options are done this way (just for the
options taking args). Presumably we could do this for LOOP also.
Question: would the existing LOOP with hacked syntax be acceptable
as a standard? Are there any clauses that are retained for historical
reasons only, or are all of them frequently enough useful to be
retained? The debate of several months ago was pretty anemic -
does this mean that nobody cares and the unreadable DO + sequence
functions is popular?