SL is a Domain Specific Language (ie. simple programming language) for dealing with ambiguous dependency situations. It is more expressive than the standard method in Common Lisp: the use of reader macros.
The only external macro is
defsl. There is BNF below, though some
examples are in order.
operator-arglist (in the current package) as
slynk is unavailable, in which case
swank:operator-arglist is used.
(defsl operator-arglist :fn :eq slynk swank)
:fn shows that a FUNCTION is being defined, as opposed to a
symbol; to define another namespace a list is required:
:eq denotes that the packages have the same name for this
function. For this simplest of examples, consider the reader macro
#+(and slynk swank) (setf (symbol-function 'operator-arglist) slynk:operator-arglist) #+(and slynk (not swank)) (setf (symbol-function 'operator-arglist) slynk:operator-arglist) #+(and (not slynk) swank) (setf (symbol-function 'operator-arglist) swank:operator-arglist) #
(defsl gensymmer (macro-function macro-function) utils with-unique-names alexandria with-gensyms)
To break this down:
gensymmeris now defined as
macro-functionwas used twice: once as a
setfableplace, and once as a
- If the
utilspackage does not exist, then
sl::gensymmeris defined as
- to define different names for each package, they must be "qualified" with the package name.
Use ASDF to install. Usually this should work:
$ cd ~/common-lisp/ $ git clone email@example.com:equwal/sl.git CL-USER> (asdf:load-system :sl)
(defsl <sl-name> <fnsym> <package spec>) <package spec> ::= <eq> | <packages> <eq> ::= :eq <preferences> <fnsym> ::= :fn | :sym | <fnpair> <fnpair> ::= (setfable-place bound-predicate) <packages> ::= <package> <fn name> <more packages> <package> ::= symbol <fn name> ::= symbol <preferences> ::= <package> <more packages> <more packages> ::= ε | <package> | <package> <more packages>
- This is a new thing.
defslis quite possibly the world's most unhygenic macro: don't expect anything about evaluation order or number of evaluations to be true.