reference to an interface
kris
foo at bar.com
Tue Apr 11 13:16:25 PDT 2006
Jari-Matti Mäkelä wrote:
> kris wrote:
>
>>Jari-Matti Mäkelä wrote:
>>
>>>kris wrote:
>>>
>>>
>>>>Frank Benoit wrote:
>>>>
>>>>
>>>>>An interface is something like a promise. A class implementing an
>>>>>interface promises to have all these methods. Your class C2 is
>>>>>overriding the method from C1 that's all. Your two "help" methods are
>>>>>not two different one, they are the same.
>>>>>
>>>>>C2 promises twice to implement a methods "void help();", inherants the
>>>>>one from C1 and overrides it.
>>>>
>>>>That's a really good analogy/description ...
>>>
>>>
>>>Indeed. But when will it promise to sort things too (== when will it
>>>really treat instances of an interface as objects) ;)
>>>
>>>#interface comparable {
>>># int opCmp(Object o);
>>>#}
>>>#
>>>#class item : comparable {
>>># int opCmp(Object o) { return 1; }
>>>#}
>>>#
>>>#void main() {
>>># comparable[] c; // compiler/lang spec "problem" here
>>># c ~= new item;
>>># c ~= new item;
>>># c ~= new item;
>>>#
>>># c.sort; // segfaults here
>>>#}
>>>
>>>
>>
>>
>>That's an implementation issue. D had a long and sordid history in this
>>regard ~ I used to be one of the primary antagonists, but gave up long ago
>
>
> Well, for me it's the only real problem in D. I can live with imports
> "polluting" namespaces now, but really hope that someday (in the not too
> distant future) D will correctly support interfaces. Walter already
> implemented that covariance part of interfaces, so there's much less to
> implement now (at least Walter admitted that some work needs to be done ;)
> Hope you still like the other aspects of D
D always held immense promise.
> since I really appreciate the
> work you've done with Mango.
I'm but one part of that project, but thank you, and you're welcome!
More information about the Digitalmars-d-learn
mailing list