Re: Do interfaces make sense in multiple dispatch languages?
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
Quoting Isaac Gouy <[email protected]>: > The computational model isn't what people are used to - we need to say > it loud and often to overcome their previous experience. That much I > agree with. I agree. But, also I think that the concrete syntax should closely correspond to the abstract syntax of the language when possible. I don't think that the current "interface"/"implements interface" syntax does this. > > In Nice, all we can say is that an interface introduces a type; it > > does not define a set of methods. That is why I suggested to > > replace "interface Y { }" with "type Y" and "class X extends Z > > implements Y { ... }" with "class X <: Y" (read "class X > > extends Z and conforms to type Y"). > > If an interface is a type, what's a class? Isn't a class a type? An interface just defines a type. A class defines a type and a concrete "physical" representation of that type (namely a set of fields). So, a class is "more" than a type. You can imagine seperating the two roles of class definition so that you can say class=interface+representation, ala Cecil: class A { ... } class B { ... } class C extends A { } // new C() instanceof A == true // C inherits fields from A. class C subclasses A { } // new C() instanceof A == false // C inherits all fields from A class C <: A { } // new C() instanceof A == true // C does not inherit any fields from A class C <: B extends A { } // new C() instanceof A == true // new C() instanceof B == true // C inherits fields from A // C does not inherit fields from B class C <: A subclasses B { } // new C() instanceof A == true // new C() instanceof B == false // C inherits frields from B // C does not inherit fields from A > > The more I think about this the more it seems I am suggesting that > > the Nice team re-implement Cecil. > That would be a Cecil that can reuse existing Java libraries? I believe that the Vortex compiler could compile Java code into C and Cecil code into C, and that both could be linked together into one binary. But, another key feature of Cecil was that static typing is optional, whereas in Nice it is mandatory. - Brian ------------------------------------------------------- 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