From: Tunc Simsek
Subject: MOP specializations (consistency)
Date: 
Message-ID: <Pine.SOL.4.10.10009242143110.15317-100000@stout.EECS.Berkeley.EDU>
Just a question on specializing a class.  Say I have

(defclass my-class (standard-class)
  ((extra-feature :initarg :extra-feature)))

and that

(defclass a ())
(defclass b (a) ()
  (:extra-feature 'this 'that)
  (:metaclass my-class))

Now, can B really be a subclass of A?  How would
it, for example, inherit the EXTRA-FEATURES?
Is there any texts,articles on specialization rules etc ...

Thanks,
Tunc

p.s. As an analogy,

class A {}
class B:A {}

class D {
  public:
    A a;}

class E:D {
 public:
   B a;}

would give an error in C++ (I think)
That is, when the metaclass is seen as a property,slot or variable
of the class, C++ demands that the more special is a super.

From: Pierre R. Mai
Subject: Re: MOP specializations (consistency)
Date: 
Message-ID: <87snqopxmj.fsf@orion.bln.pmsf.de>
Tunc Simsek <······@stout.EECS.Berkeley.EDU> writes:

> Just a question on specializing a class.  Say I have
> 
> (defclass my-class (standard-class)
>   ((extra-feature :initarg :extra-feature)))
> 
> and that
> 
> (defclass a ())
> (defclass b (a) ()
>   (:extra-feature 'this 'that)
>   (:metaclass my-class))
> 
> Now, can B really be a subclass of A?  How would
> it, for example, inherit the EXTRA-FEATURES?
> Is there any texts,articles on specialization rules etc ...

Indeed it can, as long as the metaclass my-class allows it.  You might
want to take a look at the generic function VALIDATE-SUPERCLASS that
is part of the MOP, which decides whether a superclass is valid or not
for a given class.

How extra-features is inherited depends how my-class handles
inheritance of extra-features:  You could e.g. pretend that
extra-features of standard-class classes is empty, or has some default
value, ...  That all lies in the responsibility of the metaclass...

Allowing such orthogonal inheritance of features is one of the reasons
that the metaclass hierarchy doesn't mirror the class hierarchy in
CLOS (see earlier discussions of this...)

I think that the AMOP should give enough examples of doing stuff like
this...

Regs, Pierre.

-- 
Pierre R. Mai <····@acm.org>                    http://www.pmsf.de/pmai/
 The most likely way for the world to be destroyed, most experts agree,
 is by accident. That's where we come in; we're computer professionals.
 We cause accidents.                           -- Nathaniel Borenstein
From: Tunc Simsek
Subject: Re: MOP specializations (consistency)
Date: 
Message-ID: <39D12862.C1E85B49@robotics.eecs.berkeley.edu>
"Pierre R. Mai" wrote:
> 
> Tunc Simsek <······@stout.EECS.Berkeley.EDU> writes:
> 
> > Just a question on specializing a class.  Say I have
> >
> > (defclass my-class (standard-class)
> >   ((extra-feature :initarg :extra-feature)))
> >
> > and that
> >
> > (defclass a ())
> > (defclass b (a) ()
> >   (:extra-feature 'this 'that)
> >   (:metaclass my-class))
> >
> > Now, can B really be a subclass of A?  How would
> > it, for example, inherit the EXTRA-FEATURES?
> > Is there any texts,articles on specialization rules etc ...
> 
> Indeed it can, as long as the metaclass my-class allows it.  You might
> want to take a look at the generic function VALIDATE-SUPERCLASS that
> is part of the MOP, which decides whether a superclass is valid or not
> for a given class.
> 
> How extra-features is inherited depends how my-class handles
> inheritance of extra-features:  You could e.g. pretend that
> extra-features of standard-class classes is empty, or has some default
> value, ...  That all lies in the responsibility of the metaclass...
> 
> Allowing such orthogonal inheritance of features is one of the reasons
> that the metaclass hierarchy doesn't mirror the class hierarchy in
> CLOS (see earlier discussions of this...)

The only problem that is immediate to me is that of inheritance
and possibly an MOP based specialization that would use CHANGE-CLASS-...
to set the metaclass of a class.  Could you point me to the 'earlier
discussions'; are they on some archive service? (excuse my ignorance
of news group facilities)  

Thanks,
Tunc

> 
> I think that the AMOP should give enough examples of doing stuff like
> this...
> 
> Regs, Pierre.
> 
> --
> Pierre R. Mai <····@acm.org>                    http://www.pmsf.de/pmai/
>  The most likely way for the world to be destroyed, most experts agree,
>  is by accident. That's where we come in; we're computer professionals.
>  We cause accidents.                           -- Nathaniel Borenstein
From: Barry Margolin
Subject: Re: MOP specializations (consistency)
Date: 
Message-ID: <XynA5.55$aT.976@burlma1-snr2>
In article <·················@robotics.eecs.berkeley.edu>,
Tunc Simsek  <······@robotics.eecs.berkeley.edu> wrote:
>The only problem that is immediate to me is that of inheritance
>and possibly an MOP based specialization that would use CHANGE-CLASS-...
>to set the metaclass of a class.  Could you point me to the 'earlier
>discussions'; are they on some archive service? (excuse my ignorance
>of news group facilities)  

Most newsgroups are archived at www.deja.com.

-- 
Barry Margolin, ······@genuity.net
Genuity, Burlington, 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.