From: Carl Banks
Subject: Metaclasses reference sought
Date: 
Message-ID: <60dfb6f6.0210280943.345e073@posting.google.com>
Hello,

I'm looking for a reference (on-line or in print) that shows how to
use metaclasses in detail.  And I'm not talking about pitifully easy
stuff like how to make instance-counters.  I'm talking about building
up my own LSD-induced object system that completely upsets everything
we know about object-oriented.  I'm talking things like cyclic
inheritance, superclass slots overriding subclass slots,
single-dispatch methods, customizable variance, topologies of types,
etc.

It's for educational purposes.  I know a lot of this stuff is
typically useless and maybe impossible, but I want to know the full
power of metaobjects.

Also, I have no interest in a reference that covers this in
conjunction with MOP.

Thanks for any help,

-- 
CARL BANKS

From: ozan s yigit
Subject: Re: Metaclasses reference sought
Date: 
Message-ID: <vi4vg3m6qel.fsf@blue.cs.yorku.ca>
·······@aerojockey.com (Carl Banks) writes:

> I'm looking for a reference (on-line or in print) that shows how to
> use metaclasses in detail. [...]

> Also, I have no interest in a reference that covers this in
> conjunction with MOP.

you probably know that metaclasses originate with smalltalk, not lisp
so maybe smalltalk references may give you a better handle on this.
did you take a look at eg. Goldberg and Robson [1], chap. 5 for
starters? [maybe i misunderstand what you are after...]

oz
--
[1] Adele Goldberg and David Robson
    Smalltalk-80: The Language and its Implementation
    Addison-Wesley, 1983
    0-201-11371-6
--
don't count your chickens in glass houses
until the cows come home. -- david vestal
    
From: Nils Goesche
Subject: Re: Metaclasses reference sought
Date: 
Message-ID: <87u1j6mdy9.fsf@darkstar.cartan>
·······@aerojockey.com (Carl Banks) writes:

> I'm looking for a reference (on-line or in print) that shows
> how to use metaclasses in detail.
...
> Also, I have no interest in a reference that covers this in
> conjunction with MOP.

So, ``The Art of the Metaobject Protocol'' is not acceptable?  I
don't think there is any defined way to do such things in Lisp
other than using the MOP.  In that case you might be better off
asking in comp.object.

Regards,
-- 
Nils Goesche
Ask not for whom the <CONTROL-G> tolls.

PGP key ID #xD26EF2A0
From: Carl Banks
Subject: Re: Metaclasses reference sought
Date: 
Message-ID: <apl1kq$8ek$2@solaris.cc.vt.edu>
Nils Goesche wrote:
> ·······@aerojockey.com (Carl Banks) writes:
> 
>> I'm looking for a reference (on-line or in print) that shows
>> how to use metaclasses in detail.
> ...
>> Also, I have no interest in a reference that covers this in
>> conjunction with MOP.
> 
> So, ``The Art of the Metaobject Protocol'' is not acceptable?  I
> don't think there is any defined way to do such things in Lisp
> other than using the MOP.

I believe that CLOS can do some very advanced stuff, including
everything I've listed, using only metaclasses, and without having to
resort to MOP.

Isn't it possible to implement MOP on top of standard CLOS, anyways
(that is, if your standard-class doesn't support it, you could write
your own metaclass that does support it)?


> In that case you might be better off
> asking in comp.object.

I will, but I'm specifically interested in Common Lisp.

Thanks,


-- 
CARL BANKS
From: Nils Goesche
Subject: Re: Metaclasses reference sought
Date: 
Message-ID: <87ptttc1tf.fsf@darkstar.cartan>
Carl Banks <·······@vt.edu> writes:

> Nils Goesche wrote:
> > ·······@aerojockey.com (Carl Banks) writes:
> > 
> >> I'm looking for a reference (on-line or in print) that shows
> >> how to use metaclasses in detail.
> > ...
> >> Also, I have no interest in a reference that covers this in
> >> conjunction with MOP.
> > 
> > So, ``The Art of the Metaobject Protocol'' is not acceptable?  I
> > don't think there is any defined way to do such things in Lisp
> > other than using the MOP.
> 
> I believe that CLOS can do some very advanced stuff, including
> everything I've listed, using only metaclasses, and without
> having to resort to MOP.

The problem is that the HyperSpec, which defines Common Lisp,
does not say very much about what you can do with those
Metaclasses.  That's what AMOP is all about.

> Isn't it possible to implement MOP on top of standard CLOS,
> anyways (that is, if your standard-class doesn't support it,
> you could write your own metaclass that does support it)?

Well, I guess so, but as most CLOS implementations already
support the MOP more or less, that shouldn't be necessary :-)

See http://makeashorterlink.com/?Y2EE215F1 about this.

If you are not very familiar with CLOS, you might first want to
read Sonya Keene's book on CLOS and then... AMOP, as AMOP
illustrates very nicely the inner workings of CLOS and you get
everything to know about Metaobjects, too.

Regards,
-- 
Nils Goesche
Ask not for whom the <CONTROL-G> tolls.

PGP key ID #xD26EF2A0
From: Pascal Costanza
Subject: Re: Metaclasses reference sought
Date: 
Message-ID: <apkgec$a9v$1@newsreader2.netcologne.de>
Carl Banks wrote:
> Hello,
> 
> I'm looking for a reference (on-line or in print) that shows how to
> use metaclasses in detail.  And I'm not talking about pitifully easy
> stuff like how to make instance-counters.  I'm talking about building
> up my own LSD-induced object system that completely upsets everything
> we know about object-oriented.  I'm talking things like cyclic
> inheritance, superclass slots overriding subclass slots,
> single-dispatch methods, customizable variance, topologies of types,
> etc.

You seem to be trying to poke fun at Common Lisp, but you don't succeed 
because most of the supposedly funny things you mention actually exist.

* cyclic inheritance: You can have cyclic inheritance in protoype-based 
languages like Self, but this is usually a problem. Prototype-based 
languages are based on delegation techniques. For example, delegation is 
used in patterns like the Decorator pattern or the Strategy pattern (see 
Gamma et al., "Design Patterns"). However, these patterns cannot make 
use of the full potential of delegation, because it's hard to get 
delegation "right" in languages that want to be "right" to a certain 
extent. (For example, James Gosling wanted to include delegation in 
Java, but didn't know how to do it.)

(Note: Patterns are solutions that occur repeatedly in practice, so 
we're talking about a "serious" topic here.)

* superclasses "overriding" subclasses: That's the essence of some 
aspect-oriented techniques. AspectJ is used in some "real-world" 
projects. So obviously there is a need for these things. CLOS provides 
these features since many years. (via method combinations)

* single-dispatch methods: The popular (so-called "mainstream") 
object-oriented languages provide only single dispatch. The Visitor 
pattern (see Gamma et al.) provides a workaround for achieving something 
similar to multiple dispatch. (It's a pattern, so it's obviously 
needed.) CLOS provides multi-methods which are much more straight-forward.

* customizable variance: There's some serious research going on about 
software product-line architectures. An important topic is how to 
support "customizable" variability by finding appropriate variation 
points. Do some googling on these terms.

* topologies of types: I don't know what you mean by that.

Yes, CLOS is flexible enough to support these things.


Pascal

-- 
Given any rule, however �fundamental� or �necessary� for science, there 
are always circumstances when it is advisable not only to ignore the 
rule, but to adopt its opposite. - Paul Feyerabend
From: Carl Banks
Subject: Re: Metaclasses reference sought
Date: 
Message-ID: <apl1kq$8ek$1@solaris.cc.vt.edu>
Pascal Costanza wrote:
> Carl Banks wrote:
>> Hello,
>> 
>> I'm looking for a reference (on-line or in print) that shows how to
>> use metaclasses in detail.  And I'm not talking about pitifully easy
>> stuff like how to make instance-counters.  I'm talking about building
>> up my own LSD-induced object system that completely upsets everything
>> we know about object-oriented.  I'm talking things like cyclic
>> inheritance, superclass slots overriding subclass slots,
>> single-dispatch methods, customizable variance, topologies of types,
>> etc.
> 
> You seem to be trying to poke fun at Common Lisp, but you don't succeed 
> because most of the supposedly funny things you mention actually exist.

Sensitive, aren't we?

No I wasn't; that was a list of examples of advanced stuff that isn't
batteries-included in your typical CLOS implementation.  I didn't
expect anyone to take it too literally.  (Probably should have known
better.)


> * topologies of types: I don't know what you mean by that.

As a very simple example, imagine an object that is 42 percent type A,
and 58 percent type B.  How do you do that?  Why would you do that?  I
don't know.  Maybe it could have a use in some abstract domain.  If it
does, I'm sure CLOS is up to the challenge.


> Yes, CLOS is flexible enough to support these things.

So I've heard.  Now back to the original question: do you know of a
good reference that gives a detailed and advanced explanation of how
to do this in CLOS (which obviously requires metaclasses), and without
using MOP?

Thanks,


-- 
CARL BANKS
From: Pascal Costanza
Subject: Re: Metaclasses reference sought
Date: 
Message-ID: <apmm35$rei$1@newsreader2.netcologne.de>
Carl Banks wrote:
> Pascal Costanza wrote:
> 
>>Carl Banks wrote:
>>
[...]
>>You seem to be trying to poke fun at Common Lisp, but you don't succeed 
>>because most of the supposedly funny things you mention actually exist.
> 
> Sensitive, aren't we?
> 
> No I wasn't; that was a list of examples of advanced stuff that isn't
> batteries-included in your typical CLOS implementation.  I didn't
> expect anyone to take it too literally.  (Probably should have known
> better.)

Ah - that means I have misinterpreted your question. I am terribly sorry 
for that.

>>* topologies of types: I don't know what you mean by that.
> 
> 
> As a very simple example, imagine an object that is 42 percent type A,
> and 58 percent type B.  How do you do that?  Why would you do that?  I
> don't know.  Maybe it could have a use in some abstract domain.  If it
> does, I'm sure CLOS is up to the challenge.

...sounds interesting. Do you have at least a vague example in mind?

>>Yes, CLOS is flexible enough to support these things.
> 
> So I've heard.  Now back to the original question: do you know of a
> good reference that gives a detailed and advanced explanation of how
> to do this in CLOS (which obviously requires metaclasses), and without
> using MOP?

Hm, why do you want to avoid the MOP in the first place?


Pascal


-- 
Given any rule, however �fundamental� or �necessary� for science, there 
are always circumstances when it is advisable not only to ignore the 
rule, but to adopt its opposite. - Paul Feyerabend
From: Eugene Zaikonnikov
Subject: Re: Metaclasses reference sought
Date: 
Message-ID: <680a835d.0210300439.cf54dc0@posting.google.com>
Pascal Costanza <········@web.de> wrote in message news:<············@newsreader2.netcologne.de>...
> Carl Banks wrote:
> > Pascal Costanza wrote:

[...]

> >>* topologies of types: I don't know what you mean by that.
> > 
> > 
> > As a very simple example, imagine an object that is 42 percent type A,
> > and 58 percent type B.  How do you do that?  Why would you do that?  I
> > don't know.  Maybe it could have a use in some abstract domain.  If it
> > does, I'm sure CLOS is up to the challenge.
> 
> ...sounds interesting. Do you have at least a vague example in mind?
> 

Maybe the percentages could be used in computing class precedence
lists, instead of the default 'left-to-right' rule. It should be
doable with MOP, probably by defining a proper metaclass and
COMPUTE-CLASS-PRECEDENCE-LIST method for it.

--
  Eugene