Re: Ensuring a method exists



Pascal Costanza ha escrito:

In Java, interfaces are only necessary to make the static type system
happy. When different classes offer similar functionality and you want
to use their instances in the same place, they have to have the same
type. So either, they are derived from the same common superclass, one
is derived from the other, or they implement the same interface.
Interface types are more flexible than class types because the former
are not restricted to single inheritance. If Java classes would support
multiple inheritance, interfaces would not be necessary, but abstract
classes would be sufficient (like in C++).

Since Common Lisp is dynamically typed, you don't have to worry about
all these things. When different classes offer functionality and you
want to use their instances in the same place, you ... just use them.

Thanks Pascal. Let see if I understand it, I'll give up you an example:

For example you develop a sound application, like Cubase. Cubase uses
VST, which is an especification of abstract classes in C++. Basically,
the devolper enforces you to write a series of methods to ensure that
your plugin will work correctly in the entire system. A similar issue
happens with Java Sound.
What I don't understand from your answer is that interfaces (and
abstract classes) are something that only strongly typed languages
need. I understand that an interface is a void framework of methods
primaly, independetly of the data type of their methods or fields. How
would a CLOS programmer would enforce other users to develop plugins
for their application without an abstract class or interface? (just
asking).

.



Relevant Pages

  • Re: Ensuring a method exists
    ... Pascal Costanza ha escrito: ... When different classes offer similar functionality and you want ... Interface types are more flexible than class types because the former ... which is an especification of abstract classes in C++. ...
    (comp.lang.lisp)
  • Re: interfaces
    ... An interface will allow you to publish a standard, um, interface, for ... interface can use the functionality. ... So if you are writing a class "smee" that you want to be able to sort, ... Again, an abstract class works the same, except that abstract classes are ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: multiple inheritance
    ... slice" of functionality, and use MI to get at it from a class that has this ... to think much more about the design at this level than any most programmers ... I'm a MI AND Interface fan. ... Point 1: Aggregation ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Great SWT Program
    ... orthogonal to whether or not a program has a decent user interface. ... A few also knew the arrow keys existed. ... "useful functionality required to qualify the application as an IDE". ... Or maybe you simply use "real text editor" as a synonym for IDE; ...
    (comp.lang.java.programmer)
  • Re: Ensuring a method exists
    ... When different classes offer similar functionality and you want ... Interface types are more flexible than class types because the former ... (defgeneric rem (collection object)) ... It's left up to the responsibility of the programmer to define the right methods, or to leave them out when they are actually not necessary. ...
    (comp.lang.lisp)