emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

eieio's class allocated slots don't show on in object vectors.


From: MON KEY
Subject: eieio's class allocated slots don't show on in object vectors.
Date: Wed, 14 Oct 2009 18:30:33 -0400

On "GNU Emacs 23.1.50.1 (i386-mingw-nt5.1.2600)
    of 2009-10-13 on LENNART-69DE564 (patched)"

|> (describe-function 'describe-class)

,----
| {...}
| If CLASS is actually an object, then also display current values of
that object.
`----

Either the above doesn't make sense as written or `describe-class' doesn't
actually do what the doc says when CLASS _is_ an object.

When a slot has an :allocation :class spec evaluating objects class does not
reveal the value of the class-allocated slot.

|> (defclass tt-c ()
     ((some-s :initarg :some-s
              :allocation :class))
     "doc tt-c")

|> (defvar tt-cA nil)

|> (defvar tt-cB nil)

|> (setq tt-cA (tt-c "this-ttcA"))

|> tt-cA
;=> [object tt-c "this-ttcA"]

|> (setf (slot-value tt-cA 'some-s) "slot :some-s")

|> (slot-value tt-cA 'some-s)
;=> "slot :some-s"

|> (setq tt-cB (tt-c "this-ttcB"))

|> tt-cB
;=> [object tt-c "this-ttcB"]

|> (setf (slot-value tt-cB 'some-s) "slot :some-s onB")

|> tt-cB
;=> [object tt-c "this-ttcB"]

|> (slot-value tt-cB 'some-s)
;=> "slot :some-s onB"

|>(object-slots tt-cA)
;=>nil

(object-slots tt-cB)
;=>nil

|> (describe-class tt-c)

;=> Class tt-c
;   Documentation:
;   doc tt-c
;   Instance Allocated Slots:
;   Class Allocated Slots:
;   Slot: some-s   value = "slot :some-s onB"

|> (describe-class tt-cA)
;=> not-likely, even though a object's symbol is self-quoting.

|> (class-v tt-c)
; lotsa vector

|> (slot-exists-p tt-c 'some-s)
;=> (some-s)

|> (slot-exists-p tt-cA 'some-s)
;=> (some-s)

|> (slot-exists-p tt-cB 'some-s)
;=> (some-s)

|> (slot-boundp tt-cA 'some-s)
;=> t

|> (slot-boundp tt-cB 'some-s)
;=> t

|> (slot-makeunbound tt-cB 'some-s)
;=> unbound

|> (slot-boundp tt-cB 'some-s)
;=> nil

|> (slot-boundp tt-cA 'some-s)
;=> nil

|> (slot-value tt-cA 'some-s)
;=> unbound




reply via email to

[Prev in Thread] Current Thread [Next in Thread]