[Openmcl-devel] LOOP parallel for/as termination eval order issue.

Ron Garret ron at flownet.com
Sun Oct 17 23:40:06 PDT 2010


On Oct 17, 2010, at 11:01 PM, Kaz Kylheku wrote:

> 
> This is a kludge. It should not be necessary to
> manipulate the order of the
> clauses in order to delay a premature
> termination test.
> 
> This seriously violates the whole loop abstraction.

Actually, order-dependence is required by the spec:

6.1.1.6: ... All variables are initialized first, regardless of where the establishing clauses appear in the source. The order of initialization follows the order of these clauses.

(Not that this has any bearing on the matter at hand, I'm just pointing out that the spec explicitly disagrees with you about order-dependence doing violence to the abstraction.)

Personally I think that this is a bug in the spec, and CCL's behavior is defensible, particularly in a case like this:

(for x in list-that-turns-out-to-be-nil for y = (very-expensive-operation-whose-result-is-only-required-in-the-loop-body) ...)

Why don't you just do:

 (loop for x in nil
       for y = 3 finally (return (or y 3)))

?

rg




More information about the Openmcl-devel mailing list