[asdf-devel] Slight unportability in %DEFINE-COMPONENT-INLINE-METHODS

Daniel Herring dherring at tentpost.com
Sun Sep 6 02:47:45 UTC 2009


On Sat, 5 Sep 2009, Tobias C. Rittweiler wrote:
> %DEFINE-COMPONENT-INLINE-METHODS contains the following LOOP form:
>
> (loop for data = rest then (cddr data)
>      while data
>      for key = (first data)
>      for value = (second data)
>      ...)
>
> However, if you look at LOOP's BNF in the specification, you'll see that
> termination clauses *must* appear after :for clauses.

The obvious transform is to move WHILE down and condition the FORs.
    (loop for name in +asdf-methods+ do
         (let ((keyword (intern (symbol-name name) :keyword)))
          (loop for data = rest then (cddr data)
               for key = (and data (first data))
               for value = (and data (second data))
               while data
               when (eq key keyword) do
               (destructuring-bind (op qual (o c) &body body) value

The FOR conditions can then be dropped since (nth n nil) = nil
    (loop for name in +asdf-methods+ do
         (let ((keyword (intern (symbol-name name) :keyword)))
          (loop for data = rest then (cddr data)
               for key = (first data)
               for value = (second data)
               while data
               when (eq key keyword) do
               (destructuring-bind (op qual (o c) &body body) value

Thus this can be fixed by simply moving the WHILE down two lines.

- Daniel




More information about the asdf-devel mailing list