Commit 9033af4a authored by Nick's avatar Nick

module example, serial, import-from, pkg exports

parent ff74c5b5
......@@ -32,18 +32,41 @@
;; Modules we require for our project.
;; TODO: explain how these are loaded
:depends-on ("optima.ppcre" "command-line-arguments")
:depends-on ("optima.ppcre" "command-line-arguments" "cl-fad")
;; Finally. Our project's actual files and code,
;; and how asdf is supposed to load and build
;; our system.
:components ((:file "packages")
(:file "macros" :depends-on ("packages"))
(:file "example" :depends-on ("macros"))))
(:file "example" :depends-on ("macros"))
;; Modules allow you to create sub-directories
;; in your project. ie, "/src", "/test", etc...
;; and accept basically the same parameters that
;; the defsystem macro takes.
(:module "test" ;; name of the module, and by default the dir name
:depends-on ("example")
;; Have these files load serially, such that we
;; say each subsequent file depends on the previous.
;; We could also define this at the top level
;; if we wanted to.
:serial t
;; pathname keyword allows you to specify
;; that this module lives in a path different
;; than the name of the module
;; :pathname "my-path"
:components
((:file "example-test")))))
;; A system definition can be much more compilcated than this,
;; but currently I'm going to leave that out of the scope
;; of this project. Look at the asdf documentation for more
;; in-depth examples and explanations.
;; this example is just supposed to show off the basics.
;; Look at the asdf documentation for more in-depth examples
;; and explanations.
......@@ -23,7 +23,22 @@
;; Our libraries we defined in example.asd
;; that we were going to use.
:optima.ppcre
:command-line-arguments))
:command-line-arguments
;; Careful, this can pollute your namespace.
;; You might just want to use :import-from
;; or simply refer to the fully qualified
;; packages exported symbols (ie. "package:my-func")
)
;; We can also import individual symbols from a given
;; package to help prevent polluting our namespace.
(:import-from :cl-fad #:file-exists-p)
;; Finally, The list of symbols we're going to export
;; from our package. Our public API.
(:export #:my-test
;; ...
))
;; Now we switch to our newly created package
......
(in-package :example-lisp)
(defun my-test ()
(format t "Test passed!"))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment