4 ms·
From the webpage: > `trivial-inspect` exposes a set of utils useful in building inspectors akin to standard `inspect` and `describe`. Here is the documentatio
by db48x 2y ago
From the webpage:
> `trivial-inspect` exposes a set of utils useful in building inspectors akin to standard `inspect` and `describe`.
Here is the documentation for `inspect`, <https://www.lispworks.com/documentation/HyperSpec/Body/f_inspec.htm#inspect https://www.lispworks.com/documentation/HyperSpec/Body/f_ins...> and `describe`, <https://www.lispworks.com/documentation/HyperSpec/Body/f_descri.htm#describe https://www.lispworks.com/documentation/HyperSpec/Body/f_des...>.
I’ll quote the relevant bits here. First `describe`:
> `describe` displays information about object to stream.
> For example, `describe` of a symbol might show the symbol's value, its definition, and each of its properties. `describe` of a float might show the number's internal representation in a way that is useful for tracking down round-off errors. In all cases, however, the nature and format of the output of `describe` is implementation-dependent.
> `describe` can describe something that it finds inside the object; in such cases, a notational device such as increased indentation or positioning in a table is typically used in order to visually distinguish such recursive descriptions from descriptions of the argument object.
And finally `inspect`:
> `inspect` is an interactive version of `describe`. The nature of the interaction is implementation-dependent, but the purpose of `inspect` is to make it easy to wander through a data structure, examining and modifying parts of it.
Essentially these are built–in methods of introspection. One particularly nice thing about them is that `describe` calls a generic function named `describe-object`. Because this is a generic function, you can add specialized methods to it for your own classes. This lets you customize the output to best suit your own needs.