s-expressionists / Trucler

Environment protocol for Common Lisp compilers.
33 stars 3 forks source link

+TITLE: Trucler

This library defines a CLOS-based protocol to be used by Common Lisp compilers for environment query and update. In addition, library authors can use the =trucler-native= interface to inspect native environments. Trucler supports introspection for variables, functions, tags, blocks and optimization policies.

+BEGIN_SRC lisp

(eval-when (:compile-toplevel :load-toplevel :execute) (defvar client (make-instance 'trucler-native:client)))

(defmacro assert-local-symbol-macro-description (name &key (expansion nil expansion-p) &environment env) (let ((description (trucler:describe-variable client env name))) (check-type description trucler:local-symbol-macro-description) (when expansion-p (assert (equal expansion (trucler:expansion description)))) `(values)))

+END_SRC

* Introspection at Runtime Trucler can also be used to inspect the runtime environment - here with an example of querying the state of the variable =print-array*=.

+BEGIN_SRC lisp

(trucler:describe-variable (make-instance 'trucler-native:client) nil 'print-array) ; => #<trucler-native-sbcl::global-special-variable-description {100A7E5A23}>

+END_SRC