Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write macro for generating print-object methods #88

Open
alex-eg opened this issue Feb 17, 2020 · 0 comments
Open

Write macro for generating print-object methods #88

alex-eg opened this issue Feb 17, 2020 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@alex-eg
Copy link
Member

alex-eg commented Feb 17, 2020

Using closer-mop, do the following:

  1. Collect direct slots
  2. For each parent, collect their slots
  3. For each collected slot, print it using print-object, by inheritance order, most specific slots first
  4. If the slot is an object itself, it should be print hierarchically, with a proper indentation. That is, a tree of nested object should be print also as tree.
    E.g:
(defclass foo ()
  ((slot-a :initarg :slot-a)
   (slot-b :initarg :slot-b)))

(defclass bar (foo)
  ((slot-2nd-level :initarg :slot-2nd-level)))

(let ((a (make-instance 'bar :slot-a 12
                             :slot-b :ab
                             :slot-2nd-level (make-instance 'foo :slot-a 'a :slot-b 'b))))
  (format t "~A~%" a))
#<BAR {1004972EC3}>
Slots:
SLOT-2ND-LEVEL (BAR): #<FOO {1004972E93}>
    Slots:
    SLOT-A (FOO): A
    SLOT-B (FOO): B
SLOT-A (FOO): 12
SLOT-B (FOO): :AB
@alex-eg alex-eg added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant