3

I started looking at Edi Weitz's CL-FAD to pick up some good coding practices. One thing caught my eye when looking at cl-fad.asd. In defsystem Weitz uses :serial t which, if I understand correctly based on the docs, instructs ASDF to include :components in order of appearance. This, it seems to me, should make :depends-on redundant in such a context. Is there a reason why Weitz included the :depends-on anyway, or is it just an oversight?

Here's the defsystem part (latest Github clone):

(asdf:defsystem #:cl-fad
  :version "0.7.2"
  :description "Portable pathname library"
  :serial t
  :components ((:file "packages")
               #+:cormanlisp (:file "corman")
               #+:openmcl (:file "openmcl")
               (:file "fad")
               (:file "path" :depends-on ("fad"))
               (:file "temporary-files" :depends-on ("fad")))
  :depends-on (#+sbcl :sb-posix :bordeaux-threads :alexandria))

(asdf:defsystem #:cl-fad-test
  :version "0.7.2"
  :serial t
  :components ((:file "packages.test")
               (:file "fad.test" :depends-on ("packages.test"))
               (:file "temporary-files.test" :depends-on ("packages.test")))
  :depends-on (:cl-fad :unit-test :cl-ppcre))
Wojciech Gac
  • 1,538
  • 1
  • 16
  • 30

2 Answers2

3

Friends don't let friends use cl-fad.

cl-fad is the wrong place for "best practices" of any kind. It's a quick and dirty not-so-portable portability layer.

Use UIOP instead.

Faré
  • 952
  • 5
  • 4
  • 1
    You can compare the source code if you want, and you'll see the difference. UIOP supports 15 different implementations. cl-fad doesn't. UIOP supports plenty of corner cases that cl-fad doesn't. The interface of some cl-fad functions is just bogus. Anyway, just look at the code and you'll see. – Faré Apr 27 '14 at 03:05
2

It is possible that doing both serial and on-depends would create a conflict, i.e. that the acyclic graph defined by the on-depends wouldn't be compatible with the ordering given by sequence of the components. I doubt, but who knows, if asdf actually checks for that.

So sure, that's redundant. But yeah, redundant isn't necessarily a bad thing. Stating the on-depends in addition to the serial might provide a bit-o-info for the reader about the structure of the code.

And the developer might occasionally comment out the serial to gain the benefits that follow from that.

Ben Hyde
  • 1,503
  • 12
  • 14
  • In general I agree, but in this particular case it's quite simple: "path" and "temporary-files" depend on "fad". Period :) – Wojciech Gac Apr 09 '14 at 08:12