Re: CLOS+defstruct issues

Frode Vatvedt Fjeld <[email protected]>
Newsgroups gmane.lisp.corman
Message-ID <[email protected]>
Kenny Tilton <[email protected]> writes:

> Here is the source of talk.lisp, into which I pasted ACL results of each 
> test after they were run:
>
> (in-package :cl-user)
>
> (defstruct aaa xxx)
> (defstruct (bbb (:include aaa)) yyy)
> (defstruct (ccc (:include bbb)) zzz)

The problem is in Corman's defstruct. The classes generated by
defstruct don't get appropriate class-precedence-lists. As you can
see, the classes aaa and bbb are missing:

  (class-precedence-list (find-class 'ccc))
  => (#<Standard-Class CCC #xF30C80> #<Standard-Class STRUCTURE #x1405498>
      #<Standard-Class T #x146DDC8>)

This means that the method dispatch won't recognize ccc objects as
instances of aaa or bbb.

Strangely, this still works:

  (typep (make-ccc) 'bbb)
  => t

Fix defstruct, and your method dispatch will work too.

-- 
Frode Vatvedt Fjeld


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/xaxhjB/hdqFAA/xGHJAA/SyjtlB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
[email protected]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.