[Ecls-list] loop buglet

Daniel Herring dherring at tentpost.com
Mon Sep 22 07:17:06 UTC 2008


Here's a snippet from kmrcl.

(defun remove-keyword (key arglist)
   (loop for sublist = arglist then rest until (null sublist)
         for (elt arg . rest) = sublist
         unless (eq key elt) append (list elt arg)))

It seems to pass muster in sbcl and clozure, but ECL says

Iteration in LOOP follows body code.
Current LOOP context: FOR (ELT ARG . REST) = SUBLIST UNLESS.
Broken at SI:BYTECODES.No restarts available.

This definition compiles after removing "until (null sublist)"; it appears 
that ECL doesn't like the second FOR after the UNTIL.

According to my copy of the HyperSpec,
FOR starts a for-as-clause, a type of variable-clause.
UNTIL starts a termination-test, a type of main-clause.

The LOOP syntax is
loop [name-clause] {variable-clause}* {main-clause}* => result*

So I think ECL is strictly correct to complain; but other systems seem to 
have relaxed loop's syntax to allow for cases like this.

- Daniel




More information about the ecl-devel mailing list