Re: Nice Interfaces == Traits ?
Isaac Gouy <[email protected]>
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
> > IMO what one would wish to do, is define a single accessor method
> > for the class that has the field:
> > class Device {
> > IDescTy _desc;
> > IDescTy desc() = _desc;
> > }
> Yes, I understand this is natural in a class-based language (like
> Java). In that context, a method in an interface is just a
> requirement on the implementing classes. In Nice, methods are
> "first-class citizens", and therefore such interpretation is less
> obvious, a priori.
IMO using the keyword "interface" for what we have in Nice is a
confusion that will be difficult to overcome by documentation.
There's just too much baggage: "Interfaces on the other hand, are pure
protocol. Interfaces never define data types, and never provide a
default implementation of the methods".
The Nice interface seems more like what has become known as a Trait.
> Note that you might simply start with:
> interface Describable {
> IDescTy desc();
> }
>
> interface TIntRead extends Describable { ... }
> interface TIntWrite extends Describable { ... }
>
> Then you have only one desc() method. Is this not an acceptable
> solution?
My guess is that we'd soon have a lot of interfaces with only one method.
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn