From: John Atwood
Subject: Clos -> Closette & explicit defgeneric
Date: 
Message-ID: <7f5egd$pvm$1@news.NERO.NET>
I'm looking at making a 50 KLOC code run on multiple platforms and multiple
CL implementations. Some of the implementations use Closette as their
object system. Most of the differences between full CLOS and Closette seem
surmountable, but one seems a pain: explicit defgenerics. 

Until I get to the library for Kizcales' et al.  _the Art of the Metaobject
Protocol_, let me ask:

Why does CLOS allow elided defgenerics while Closette does not? What's the
rationale?  Couldn't Closette be patched to generate a generic upon
encountering a defmethod with no defgeneric, even if the defgeneric is
simply:
  (defgeneric bbb (arg1 ...) 
      (:method ((arg1 T) ...) (error "defgeneric patch failed.")))


Thanks,


John Atwood

From: Sunil Mishra
Subject: Re: Clos -> Closette & explicit defgeneric
Date: 
Message-ID: <efyiuaxe1r2.fsf@whizzy.cc.gatech.edu>
·······@gold.CS.ORST.EDU (John Atwood) writes:

> Why does CLOS allow elided defgenerics while Closette does not? What's the
> rationale?  Couldn't Closette be patched to generate a generic upon
> encountering a defmethod with no defgeneric, even if the defgeneric is
> simply:
>   (defgeneric bbb (arg1 ...) 
>       (:method ((arg1 T) ...) (error "defgeneric patch failed.")))
> 
> 
> Thanks,
> 
> 
> John Atwood

Simplicity? So far as I can tell, Closette was meant to be an instructional
tool, not a full-blown implementation. They chose simplicity over
efficiency and completeness. Anyone using Closette (if CLOS is natively
implemented) should be... ummm... reprimanded. So far as I can remember,
forcing an implicit defgeneric should be relatively easy to implement in
Closette.

Sunil
From: Bruno Haible
Subject: Re: Clos -> Closette & explicit defgeneric
Date: 
Message-ID: <7f87ag$n9k$1@news.u-bordeaux.fr>
John Atwood <·······@gold.CS.ORST.EDU> wrote:
>
> I'm looking at making a 50 KLOC code run on multiple platforms and multiple
> CL implementations. Some of the implementations use Closette as their
> object system.

Don't do that. Closette is a very nice and instructive reference
implementation for a MOPpy CLOS, but it is horribly inefficient. For every
generic function call, it starts out computing the list of applicable
methods, sorting it, and so on. You get, however, some reasonable
performance out of it if you add an effective method cache to every
generic function. (A simple hash table mapping (mapcar #'class-of arglist)
to the sorted list of applicable methods is sufficient.)

                   Bruno                      http://clisp.cons.org/~haible/