guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: namespaces, goops, etc.


From: Mikael Djurfeldt
Subject: Re: namespaces, goops, etc.
Date: 08 Nov 2000 06:01:57 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7

Michael Livshin <address@hidden> writes:

> Mikael Djurfeldt <address@hidden> writes:
> 
> > Actually, `define-class', `define-generic', and, `define-method' are
> > all supposed to be top-level forms and not allowed in other contexts.
> > There should be error checking in the last two as well.
> 
> but why?  ordinary defines can be both top-level and internal, so why
> not these?
> 
> I mean, `(define-class foo)' is just (ideally)
> `(define foo (make-class))', no?

These guys are all special.

1. define-class - class redefinition protocol
2. define-method - may need to define the GF
3. define-generic - may pick up a default method

3 is most questionable.  1 and 2 are both important for convenience.

BTW, personally I don't like add-method!.  I think we should head
towards constructs which can be optimized by a compiler.

For example, with my let-generic example, the local generic function
will have to be reconstructed (and its method cache rebuilt) every
time the local code is evaluated.  If we had used a closure instead,
the only work involved is the consing of the environment pointer with
the code.  A better API for local generics would give us freedom to
improve the implementation later into something similar.

Best,
Mikael



reply via email to

[Prev in Thread] Current Thread [Next in Thread]