From: Vladimir Zolotykh
Subject: AMOP: MAKE-INSTANCE BACKSTAGE
Date: 
Message-ID: <3D089C22.5831B4D9@eurocom.od.ua>
The quote from AMOP follows (from 1.5.4 Initializing Instances)

  The principal method for the generic function make-instance looks up
  the class name supplied by the user and then calls make-instance
  again with the class metaobject.

  (defmethod make-instance ((class symbol) &rest initargs)
    (apply #'make-instance (find-class class) initargs))

  A secondary method allocates a new instance of the class using
  allocate-instance, and then calls initialize-instance to initialize
  it, passing along the keyword argument list that follows the class
  argument:

  (defmethod make-instance ((class standard-class) &rest initargs)
    (let ((instance (allocate-instance class)))
      (apply #'initialize-instance instance initargs)
      instance))

  [end of quote]

Could you explain me the phrase 'call make-instance again with the
class metaobject' ? If for example make-instance is called as

  (make-instance 'person)

Call to find-class inside it

  (find-class 'person)

should return 

  #<tracking-class tracked-person>, 

so a "secondary method" should be called with this, e.g. user defined
class tracked-person, not metaclass of tracked-person (which is
tracking-class). Also standard-class is not a superclass of
tracked-person and "secondary method" would not be called. So as it seems
something is wrong. Isn't it ? For now I don't see fault in this chain.
of assumptions Do you? Do I miss some link ?

-- 
Vladimir Zolotykh

From: Barry Margolin
Subject: Re: AMOP: MAKE-INSTANCE BACKSTAGE
Date: 
Message-ID: <fs2O8.7$4w2.599@paloalto-snr2.gtei.net>
In article <·················@eurocom.od.ua>,
Vladimir Zolotykh  <······@eurocom.od.ua> wrote:
>The quote from AMOP follows (from 1.5.4 Initializing Instances)
>
>  The principal method for the generic function make-instance looks up
>  the class name supplied by the user and then calls make-instance
>  again with the class metaobject.
>
>  (defmethod make-instance ((class symbol) &rest initargs)
>    (apply #'make-instance (find-class class) initargs))
>
>  A secondary method allocates a new instance of the class using
>  allocate-instance, and then calls initialize-instance to initialize
>  it, passing along the keyword argument list that follows the class
>  argument:
>
>  (defmethod make-instance ((class standard-class) &rest initargs)
>    (let ((instance (allocate-instance class)))
>      (apply #'initialize-instance instance initargs)
>      instance))
>
>  [end of quote]
>
>Could you explain me the phrase 'call make-instance again with the
>class metaobject' ? If for example make-instance is called as
>
>  (make-instance 'person)
>
>Call to find-class inside it
>
>  (find-class 'person)
>
>should return 
>
>  #<tracking-class tracked-person>, 

Why would it return that?  It should return the class object named PERSON.

If PERSON's metaclass is something other than STANDARD-CLASS then a
different secondary method may be invoked when the second MAKE-INSTANCE
call is performed.

-- 
Barry Margolin, ······@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Takehiko Abe
Subject: Re: AMOP: MAKE-INSTANCE BACKSTAGE
Date: 
Message-ID: <keke-1406020131220001@solg4.keke.org>
In article <·················@eurocom.od.ua>, Vladimir Zolotykh <······@eurocom.od.ua> wrote:

>   (defmethod make-instance ((class symbol) &rest initargs)
>     (apply #'make-instance (find-class class) initargs))
> 
>   A secondary method allocates a new instance of the class using
>   allocate-instance, and then calls initialize-instance to initialize
>   it, passing along the keyword argument list that follows the class
>   argument:
> 
>   (defmethod make-instance ((class standard-class) &rest initargs)
>     (let ((instance (allocate-instance class)))
>       (apply #'initialize-instance instance initargs)
>       instance))
> 
>   [end of quote]
> 
> Could you explain me the phrase 'call make-instance again with the
> class metaobject' ? If for example make-instance is called as
> 
>   (make-instance 'person)

'person is a symbol naming a class metaobject.

> 
> Call to find-class inside it
> 
>   (find-class 'person)

So this should return the class metaobject named 'person. The
class <meta>object then will be passed to make-instance again.

If the class of 'person class metaobject is standard-class,
then the second method will be applied.

> 
> should return 
> 
>   #<tracking-class tracked-person>, 
> 
> so a "secondary method" should be called with this, e.g. user defined
> class tracked-person, not metaclass of tracked-person (which is
> tracking-class). 

I think you are confused by the terminology. A 'class metaobject'
and 'metaclass' are different.

An instance of 'person class is an object. And the 'person class,
in turn, is also an object -- which is 'meta' to the instance
of the 'person class and is refered to as a 'class metaobject'.

And that class metaobject is an instance of yet another class-- 
tracking-class or standard-object-- and they're called
'metaclass' == (class-of (find-class 'person)).

abe
From: Vladimir Zolotykh
Subject: Re: AMOP: MAKE-INSTANCE BACKSTAGE
Date: 
Message-ID: <3D0B4A05.C4D1F4D4@eurocom.od.ua>
Takehiko Abe wrote:
> 
> I think you are confused by the terminology. A 'class metaobject'
> and 'metaclass' are different.

You're right. So I was

> 
> An instance of 'person class is an object. And the 'person class,
> in turn, is also an object -- which is 'meta' to the instance
> of the 'person class and is refered to as a 'class metaobject'.
> 
> And that class metaobject is an instance of yet another class--
> tracking-class or standard-object-- and they're called
                    ^^^^^^^^^^^^^^^
I'd expected standard-class here rather than standard-object (thought the latter also
correct), especially in the context of AMOP description of make-instance. 

> 'metaclass' == (class-of (find-class 'person)).

-- 
Vladimir Zolotykh
From: Takehiko Abe
Subject: Re: AMOP: MAKE-INSTANCE BACKSTAGE
Date: 
Message-ID: <keke-1606022229350001@solg4.keke.org>
In article <·················@eurocom.od.ua>, Vladimir wrote:

> > And that class metaobject is an instance of yet another class--
> > tracking-class or standard-object-- and they're called
>                     ^^^^^^^^^^^^^^^
> I'd expected standard-class here rather than standard-object 

Yes. You're right. It should be standard-class.

abe