I am proposing to add support for defconstructs docstrings.
This could be achieved with a small modification to the grammar.
(deftemplate <deftemplate-name> [<docstring>]
<slot-definition>*)
<slot-definition> ::= <single-slot-definition> | <multislot-definition>
...)
Either the ; comment or a dedicated syntax could be used as implementation. See the example below borrowing from Python docstrings syntax.
(deftemplate nigiri
"""A particular type of sushi consisting of a slice of salmon
resting on a base of rice."""
(slot type (type SYMBOL))
(slot price (type INTEGER)))
(defclass MAKI (is-a SUSHI)
"""A roll-shaped sushi wrapped in seaweed."""
(slot type (type SYMBOL))
(slot price (type INTEGER)))
(deffunction roll-a-maki (?maki-type)
"""Makes a new instance of a MAKI given its type."""
(make-instance [maki] of MAKI (type ?maki-type) (price 3)))
(defrule nigiri-set-order
"""Bundles a customer order in a nigiri set."""
(nigiri (type salmon))
(nigiri (type tuna))
(nigiri (type avocado))
=>
(place-order nigiri-set))
This would allow to simplify the exploration or a rule set from the REPL. A builtin help function could be provided for that.
CLIPS> (help nigiri-set-order)
Rule
Bundles a customer order in a nigiri set.
As well, C APIs such as DeftemplateDocstring would allow to integrate to other environments.