Clos -> Closette & explicit defgeneric 
Author Message
 Clos -> Closette & explicit defgeneric

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



Mon, 01 Oct 2001 03:00:00 GMT  
 Clos -> Closette & explicit defgeneric

Quote:

> 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



Mon, 01 Oct 2001 03:00:00 GMT  
 Clos -> Closette & explicit defgeneric

Quote:

> 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/



Tue, 02 Oct 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Problem with J table adverb & explicit definition

2. Encapsulating CLOS (was: Diff. CLOS vs C++)

3. CLOS->Dylan Translation

4. Encapsulating CLOS (was: Diff. CLOS vs C++)

5. Encapsulating CLOS (was: Diff. CLOS vs C++)

6. defgeneric and then defun signals no error

7. CLOS -> Rational Rose

8. CMUCL: defclass and defgeneric

9. Encapsulating CLOS (was: Diff. CLOS vs C++)

10. FLAVORS -> CLOS

11. Method combinations and DEFMETHOD/DEFGENERIC

12. HELP>>>>>>>Fortran-Pascal Linking

 

 
Powered by phpBB® Forum Software