Mark Hartoog wrote: > Defining the struct in a package clearly makes this legal, but I think > the fundamental question is what is a interface. If an interface is > structural, then different instances of the interface create > different types. On the other hand, if a struct were defined in a class, > we would not say that every class instance created a new type of the > struct. No, but each instance of the class *type* (in different module instances) does constitute a new type. > So what is an interface? Is it a type like a class or is it a structural > instance? Right now the LRM seems to treat an interface as a little of > both and that is what is creating this problem. If we make an interface > more like a type, this problem will go away. I agree that the "typeness" of the interface is a key question. For parameterized classes (which are the closest "type" relative), it is clear that there is a separation of "type" and "object". The rules for type equivalence of specialization are pretty clear and apply globally. One alternative would be to more clearly distinguish the "type" of an interface and to have that be more global in the same manner as for a parameterized class. Unfortunately, due to the instantiation aspects of interfaces, this would make things pretty murky. For a parameterized class it is clear what "static" means and that it is tied to the type. How one would interpret this for normal interface-level declarations would likely be different and/or would be quite different than what people expect right now. Before going down this route, I think that we'd want to carefully consider whether there was some common abstraction underlying both "interface types" and parameterized classes in order to keep the conceptual complexity down to something reasonable. Gord. -- -------------------------------------------------------------------- Gordon Vreugdenhil 503-685-0808 Model Technology (Mentor Graphics) gordonv@model.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Fri Jan 5 08:31:17 2007
This archive was generated by hypermail 2.1.8 : Fri Jan 05 2007 - 08:31:24 PST