Extensible languages in Clojure, a la Racket's #lang.
This is a simple library that monkey patches clojure.core/load to be extensible to different backends.
monkey-patch-extensible-load
does the actual monkey-patching and
must be called explicitly.
lang-dispatch
is a map from keywords to alternative load
functions
(of type [String -> nil]). The corresponding function will be used to
load a file according its :lang metadata entry in the ns
form.
To add a new implementation, use (alter-var-root lang-dispatch assoc :new-impl my-load)
eg. A file with a ns
form
(ns fancy-ns-form
{:lang :new-impl})
will use my-load
to load the file.
Extensible languages in Clojure, a la Racket's #lang. This is a simple library that monkey patches clojure.core/load to be extensible to different backends. `monkey-patch-extensible-load` does the actual monkey-patching and must be called explicitly. `lang-dispatch` is a map from keywords to alternative `load` functions (of type [String -> nil]). The corresponding function will be used to load a file according its :lang metadata entry in the `ns` form. To add a new implementation, use (alter-var-root lang-dispatch assoc :new-impl my-load) eg. A file with a `ns` form (ns fancy-ns-form {:lang :new-impl}) will use `my-load` to load the file.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close