Implement cl object methods for Emacs interop
Opened this issue · 0 comments
Each Elsa object should have two printing methods:
-
one to serialize the object, in a way that this can be read back to reconstruct the object =>
object-write
. Slots can have overriding printers via:printer
property -
one to print the object in a human readable way (for debugger etc). We will always use the
#<class some-readable-representation>
format. =>cl-print-object
. For a class hierarchy when reasonable we can use top-level class, since this does not need to be readable back into lisp. -
some classes might have specialised methods, for example
elsa-type
needs serialization in aelsa-make-type
compatible form (rather than a string?), andelsa-form
should be able to turn into a lisp form. -
use
eieio-override-prin1
as printer for object types so there is no useless indent -
rename
elsa-tostring
toelsa-to-string
-
elsa-type
-
elsa-type-describe
-> maybe return a form instead, which could then be turned into a string. So this would return lisp formsstring
(symbol) or(list string)
which could be(format "%s" x)
. -
cl-print-object
=>#<elsa-type string>
or#<elsa-type (list string)>
=> single implementation for type using the "description" to print the actual type. -
object-write
=>(elsa-type-string)
or(elsa-type-list :item-type (elsa-type-string))
-
-
elsa-form
-
elsa-form-print
-> we already haveelsa-form-to-lisp
which can then be turned into string -
cl-print-object
=>#<elsa-form :foo>
or#<elsa-form (list :list 1)
=> single implementation for all the forms with just a prefix#<elsa-form
.
-