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

Re: Interfaces



>>>>> "Neel" == Neel Krishnaswami <neelk@brick.cswv.com> writes:

 Neel> Scott McKay <swm@mediaone.net> wrote:
 >> Rob Myers wrote in message ...
 >> >
 >> > Java's interfaces are broken, IMHO! Anything that allows naming
 >> > clashes whilst disallowing code reuse is a real worst of both
 >> > worlds solution.  Protocols are used in Dylan instead, aren't they?

 Neel> ISTM you can get most of the way there with modules already.

 Neel> Do something like

 Neel>   define module foo-interface
 Neel>      create
 Neel>        bar, baz;
 Neel>   end module;

 Neel> To implement the interface, define a new module that uses the
 Neel> interface:

 Neel>   define module foo-implementation
 Neel>     use foo-interface, export: all;
 Neel>   end module;

One shortcoming of Dylan's module system is that you cannot be more
specific than names -- i.e. you can't specify the type signature of
methods or generic functions at the module level.  At least Java
interfaces allow you to specify the names _and_ types of methods that
must be implemented.

Having type signatures as part of the module system would enable
better cross-module type checking and better optimization.
-- 
Greg      gregs@ai.mit.edu (617)253-5807
Sullivan  http://www.ai.mit.edu/~gregs/


Follow-Ups: References: