DMD 0.150 release
xs0
xs0 at xs0.com
Wed Mar 22 07:29:05 PST 2006
Stewart Gordon wrote:
> xs0 wrote:
>> Walter Bright wrote:
>>> I wanted to get the interface covariant problem fixed for the library
>>> guys.
>>>
>>> http://www.digitalmars.com/d/changelog.html
>>
>> Out of curiosity - how did you implement it?
>
> The same way in which covariantly overriding a class method is
> implemented, surely. Strikes me as trivial ... unless "the" interface
> covariant problem is something different from the two interface
> covariant problems I've seen....
Well, there's quite a difference between classes and interfaces in
handling covariance:
- all class references to the same object have the same value (i.e. they
point to the same address), regardless of their type
- interface references to the same object, on the other hand, don't
point to the same address
So, for class covariance to work, nothing needs to be done, except of
course checking at compile time whether the two types are indeed
covariant. With interfaces, some juggling needs to be done to produce
the correct reference.
Of course, all that interface ref juggling produces problems, and I've
been trying to convince Walter to change the way interfaces are
implemented, but no success so far :)
xs0
More information about the Digitalmars-d-announce
mailing list