[Top][All Lists]

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

Re: GOOPS %modify-[instance|class]

From: Mikael Djurfeldt
Subject: Re: GOOPS %modify-[instance|class]
Date: Fri, 10 Jan 2003 11:12:02 +0100
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-pc-linux-gnu)

Clinton Ebadi <address@hidden> writes:

> I think %modify-instance and -class should be public.

Could you be more specific why?  These seem pretty strange and magical
to me, and might change as the implementation evolves...

> I specialized change-class and change-object-class (to the same
> thing, just to be safe because the manual says either one may be
> called but not both).

The manual shouldn't mention change-object-class since that is a
private part of the implementation.  BTW, change-class is a generic
function while change-object-class is a prociedure.

> I seem to have a problem: when I return the updated class, all my
> pointers to the old class are invalidated! And then it seems that
> GOOPS continues in an infinite loops updated the same objects over
> and over again.

Could you please explain what you want to do.  You talk about
returning an updated class.  But this only happens if one is using
change-class to change the metaclass of a class instance.  The normal
job for change-class is to change the class of an instance.

Here's an example of specialization to change-class:

(define-class <class-change-notice-class> (<class>))

(define-method (change-class (o <object>) (c <class-change-notice-class>))
  (format #t "class changed for instance ~A\n" o))

(define-class c () (x) #:metaclass <class-change-notice-class>)
(define o (make c))
;;; Now we redefine c:
(define-class c () (x) (y) #:metaclass <class-change-notice-class>)
;;; If we now refer to o, it will be lazily updated:
class changed for instance #<c 807f890>
#<c 807f890>

This seems to work.

Could you please give me enough information to reproduce the infinite
loop you are talking about?

Best regards,
Mikael Djurfeldt

reply via email to

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