unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* eieio's class allocated slots don't show on in object vectors.
@ 2009-10-14 22:30 MON KEY
  0 siblings, 0 replies; only message in thread
From: MON KEY @ 2009-10-14 22:30 UTC (permalink / raw)
  To: emacs-devel

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-10-14 22:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-14 22:30 eieio's class allocated slots don't show on in object vectors MON KEY

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).