There is some support for
defclasses as alists in EIEIO but I was wondering if there is any support to read/write a
defclass as a property list (plist)?
e.g. using the example
(defclass record () ; No superclasses ((name :initarg :name :initform "" :type string :custom string :documentation "The name of a person.") (birthday :initarg :birthday :initform "Jan 1, 1970" :custom string :type string :documentation "The person's birthday.") (phone :initarg :phone :initform "" :documentation "Phone number.")) "A single record for tracking people I know.")
it would be good to be able to create an instance of this class and then be able to marshall it into a plist (e.g. for over-the-wire transfer)
(:name "Sam" :birthday "Jan 1, 1980" :phone "0123456789")
and be able to do the opposite: take a plist (and the class name
'record) and turn it into an instance of
There is some ambiguity around using the slot name, initarg, or accessor name, so I'd suggest just using the initarg for everything to be consistent.
When there is a hierarchy involved, it would be good to include the name of the class in the plist, e.g.
(:type 'record :name "Sam" :birthday "Jan 1, 1980" :phone "0123456789")
I am only really looking for support for Algebraic Data Types: products (simple classes) and coproducts (children of a parent, sealed traits in scala terms).