Re: Former C++ Programmer Approaches Lisp
- From: tar@xxxxxxxxxxxxx (Thomas A. Russ)
- Date: 07 Apr 2005 13:41:01 -0700
Carl Shapiro <cshapiro+spam@xxxxxxxxx> writes:
>
> Kenny Tilton <ktilton@xxxxxxxxxx> writes:
>
> > Interfaces are OOPs' way of saying "Sh*t, we acknowledge the need for
> > multiple inheritance but this is as close as we can get. Hope ya like
> > it!"
>
> I think this is an overly simplistic way to view interfaces. You can
> get yourself into trouble with CLOS if you define a class which
> multiply inherits super classes which have conflicting slots. This
> situation is exacerbated if, for example, the slots have different
> allocation policies. Interfaces compromise by not allowing state to
> be multiply inherited. This compromise is not without merit.
Well, with proper use of namespaces and naming discipline, this is not
supposed to happen. (Yeah, in practice it doesn't always work that
way), but the philosophy is that a slot named by a particular symbol is
supposed to have only one meaning. So one would really ideally have
something like ship:deck and card:deck to differentiate slots that would
otherwise have similar names.
The drawback to interfaces is that if you ever want an interface that
needs to have state, then you have to make sure you add the slots for
that state into your object. And in Java it is even worse, because
interfaces can only contain abstract methods. Which means you have to
implement all the methods for an interface whenever you want to include
it for inheritance. This is not only annoying, but it removes a lot of
the benefit of using OOP in the first place.
--
Thomas A. Russ, USC/Information Sciences Institute
.
- Follow-Ups:
- Re: Former C++ Programmer Approaches Lisp
- From: Carl Shapiro
- Re: Former C++ Programmer Approaches Lisp
- References:
- Former C++ Programmer Approaches Lisp
- From: Takuon Soho
- Re: Former C++ Programmer Approaches Lisp
- From: jmckitrick
- Re: Former C++ Programmer Approaches Lisp
- From: Kenny Tilton
- Re: Former C++ Programmer Approaches Lisp
- From: Christopher Koppler
- Re: Former C++ Programmer Approaches Lisp
- From: Kenny Tilton
- Re: Former C++ Programmer Approaches Lisp
- From: Carl Shapiro
- Former C++ Programmer Approaches Lisp
- Prev by Date: Re: Former C++ Programmer Approaches Lisp
- Next by Date: Re: ? (- 1 .999)
- Previous by thread: Re: Former C++ Programmer Approaches Lisp
- Next by thread: Re: Former C++ Programmer Approaches Lisp
- Index(es):
Relevant Pages
|