https://github.com/s-expressionists/trucler
Environment protocol for Common Lisp compilers.
https://github.com/s-expressionists/trucler
Last synced: about 2 months ago
JSON representation
Environment protocol for Common Lisp compilers.
- Host: GitHub
- URL: https://github.com/s-expressionists/trucler
- Owner: s-expressionists
- Created: 2019-01-24T08:46:21.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-01-06T17:07:56.000Z (over 1 year ago)
- Last Synced: 2025-02-10T01:38:47.921Z (4 months ago)
- Language: Common Lisp
- Size: 308 KB
- Stars: 33
- Watchers: 8
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
#+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.* Examples
** Introspection at Macroexpansion Time
The following macro can be used to ensure the presence of a local symbol
macro, and to see whether it has the expected expansion:#+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*)
; => #
#+END_SRC* Related Work
Trucler can be seen as a modern, extensible version of the protocol
described in section 8.5 of the second edition of Guy Steele's book [[https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node102.html#SECTION001250000000000000000][Common
Lisp, the Language]].