Next: , Previous: , Up: Making a small Lisp project with quickproject and Quicklisp   [Contents][Index]


5.10.1.4 Reorganize

  1. For small projects, sometimes a single file suffices. Most of the time, though, I end up splitting code up into multiple files.
  2. In this example, I might make
    • a file called utils.lisp,
    • a file called graphics.lisp, and
    • a file called web.lisp, and
    • update the system definition by quickproject to:
    (asdf:defsystem #:swatchblade
      :serial t
      :depends-on (#:vecto
                   #:hunchentoot)
      :components ((:file "package")
                   (:file "utils")
                   (:file "graphics")
                   (:file "web")
                   (:file "swatchblade")))
    
  3. When the ‘:serial t’ option is present in the defsystem, files are compiled and loaded in order. You can get more complicated in expressing inter-file relationships, but I haven’t found it worth the trouble. I just organize my files so that functions and macros needed in later files are provided in earlier files.