From: Kelly E Murray
Subject: Re: adding class sealing to CLOS?
Date: 
Message-ID: <45ltaf$epi@sand.cis.ufl.edu>
In article <···················@stratus.CAM.ORG>, ·····@stratus.CAM.ORG (Kaveh Kardan) writes:
> 
> Has anyone given thought to adding Dylan-like class sealing to CLOS?
> 

Common Lisp'ers have been talking about this for a long time.
I have the impression it's been an issue thought best left to
vendors to implement as a high-performance extension for "delivery".

There is also another mechanism similiar to class sealing which I was
proposing years ago called "base classes" which dylan appears to have
included called "primary classes".
It allows fast slot-value lookup for base classes by restricting them
to single-inheritance.  Multiple inheritance is still supported, but
any given class can only inherit a single base class.
So, you must give some thought about what classes you make base classes,
which in many ways is best left until later when you have a good idea
about what the structure of your application is.

An example might be 

  (defclass 2d ()                     ((x) (y))  (:base-class))
  (defclass 3d (2d)                   ((z))      (:base-class))
  (defclass sphere (3d)               ((dia))  )

  (defclass color-mixin ()            ((color)) )
  (defclass colored-sphere (3d color) ()  )

which would makes the coordinate lookups for objects in space faster,
but then you can't at the same time have another class that is also fast,
which in this case would be the color-mixin.

Notice that a CLOS base-class is a good candidate for replacing defstruct!

-Kelly Murray   ···@franz.com    http://www.franz.com

  

From: Jeff Dalton
Subject: Re: adding class sealing to CLOS?
Date: 
Message-ID: <DGI34I.1AB@cogsci.ed.ac.uk>
···@cis.ufl.edu (Kelly E Murray) writes:


>In article <···················@stratus.CAM.ORG>, ·····@stratus.CAM.ORG (Kaveh Kardan) writes:
>> 
>> Has anyone given thought to adding Dylan-like class sealing to CLOS?
>> 

>Common Lisp'ers have been talking about this for a long time.
>I have the impression it's been an issue thought best left to
>vendors to implement as a high-performance extension for "delivery".

>There is also another mechanism similiar to class sealing which I was
>proposing years ago called "base classes" which dylan appears to have
>included called "primary classes".

A similar idea came up in EuLisp and was called "mixin inheritance".
There's CL code somewhere on the net that implements it.  Look for
"mcs" (maybe) in the FAQ.

-- jeff
From: Ken Anderson
Subject: Re: adding class sealing to CLOS?
Date: 
Message-ID: <KANDERSO.95Oct19141312@lager.bbn.com>
In article <··········@sand.cis.ufl.edu> ···@cis.ufl.edu (Kelly E Murray) writes:
>   (defclass 2d ()                     ((x) (y))  (:base-class))
>   (defclass 3d (2d)                   ((z))      (:base-class))
>   (defclass sphere (3d)               ((dia))  )
> 
> which would makes the coordinate lookups for objects in space faster,
> but then you can't at the same time have another class that is also fast,
> which in this case would be the color-mixin.
> 
> Notice that a CLOS base-class is a good candidate for replacing defstruct!

Yes.  It would be nice to have a range of light weight metaclasses we could
choose from.  Mike Thome (······@bbn.com) suggested how these could be used
to improve the performance of an application without changing a line of
code.  The idea is to use the introspective MOP to grovel over the class
hierarchy and choose an optimized metaclass for each class.  Then recompile
your code using these metaclasses as compiler hints.  For a simple version
of this idea see:

ftp://openmap.bbn.com/pub/kanderson/faster95/qacc/qacc.lisp

k
From: Ken Anderson
Subject: Re: adding class sealing to CLOS?
Date: 
Message-ID: <KANDERSO.95Oct19141312@lager.bbn.com>
In article <··········@sand.cis.ufl.edu> ···@cis.ufl.edu (Kelly E Murray) writes:
>   (defclass 2d ()                     ((x) (y))  (:base-class))
>   (defclass 3d (2d)                   ((z))      (:base-class))
>   (defclass sphere (3d)               ((dia))  )
> 
> which would makes the coordinate lookups for objects in space faster,
> but then you can't at the same time have another class that is also fast,
> which in this case would be the color-mixin.
> 
> Notice that a CLOS base-class is a good candidate for replacing defstruct!

Yes.  It would be nice to have a range of light weight metaclasses we could
choose from.  Mike Thome (······@bbn.com) suggested how these could be used
to improve the performance of an application without changing a line of
code.  The idea is to use the introspective MOP to grovel over the class
hierarchy and choose an optimized metaclass for each class.  Then recompile
your code using these metaclasses as compiler hints.  For a simple version
of this idea see:

ftp://openmap.bbn.com/pub/kanderson/faster95/qacc/qacc.lisp

k