Re: Ensuring a method exists
- From: Jack Unrue <no.spam@xxxxxxxxxxx>
- Date: Thu, 28 Sep 2006 04:12:20 GMT
On 27 Sep 2006 15:02:48 -0700, "Javier" <javuchi@xxxxxxxxx> wrote:
Going on with this matter, and because I don't fully understand all the
answers you have done:
How would you implement an interface using CLOS with lots of different
methods? For example:
interface Collection {
void add (Object o);
void remove (Object o);
...
}
In CLOS terms, you think of the add, remove, etc operations comprising
a protocol. You use DEFGENERIC to define a generic function for each
operation; the resulting set of generic functions embodies the logical
protocol. Then given classes for which those operations apply,
you use DEFMETHOD to provide implementations. Note that CLOS methods
belong to generic functions, not to classes.
There is no construct in CLOS that corresponds to the Java interface
syntax. The concept of a protocol is something you would describe in
documentation, but it is not manifested as any Lisp object that you
can manipulate.
--
Jack Unrue
.
- References:
- [CLOS] Ensuring a method exists
- From: Didier Verna
- Re: [CLOS] Ensuring a method exists
- From: Lars Rune Nøstdal
- Re: [CLOS] Ensuring a method exists
- From: Didier Verna
- Re: [CLOS] Ensuring a method exists
- From: Ken Tilton
- Re: [CLOS] Ensuring a method exists
- From: Christophe Rhodes
- Re: [CLOS] Ensuring a method exists
- From: Ken Tilton
- Re: [CLOS] Ensuring a method exists
- From: Pascal Costanza
- Re: [CLOS] Ensuring a method exists
- From: Ken Tilton
- Re: [CLOS] Ensuring a method exists
- From: Pascal Costanza
- Re: Ensuring a method exists
- From: Javier
- [CLOS] Ensuring a method exists
- Prev by Date: Re: [CLOS] Ensuring a method exists
- Next by Date: Re: Pocket Lisp Machine
- Previous by thread: Re: Ensuring a method exists
- Next by thread: Re: Ensuring a method exists
- Index(es):
Relevant Pages
|