DMD 0.150 release

Stewart Gordon smjg_1998 at yahoo.com
Thu Mar 23 02:47:41 PST 2006


xs0 wrote:
> Stewart Gordon wrote:
<snip>
>> What is this other issue you're talking about, which is also fixed?
> 
> I was just trying to say covariance is not done the same way with 
> interfaces as with classes, and is not quite as trivial :)

Yes, but UIMS it _is_ trivial for the bug that I've discovered is fixed.

If you take this case (issue (a) in my last post)

----------
class Qwert {}

interface Yuiop {
     Qwert asdfg();
}

class Hjkl : Yuiop {
     Hjkl asdfg() { return new Hjkl; }
}
----------

then since Qwert and Hjkl are both classes, and as you say

>>> - all class references to the same object have the same value 
>>> (i.e. they point to the same address), regardless of their type

no runtime conversion is needed.  The problem was purely that, when the 
compiler checked whether an interface is fully implemented, it would 
check for an exact match instead of a covariant match.

OTOH Walter also said in another branch:

"The type returned by a virtual function is the type of its introducing
function. After the function returns, it is cast to the derived return 
type."

This doesn't matter to issue (a), but it's what I had thought up before 
as a way of dealing with issue (b).  However, issue (b) isn't fixed, so 
I'm wondering what it's about.  Is there a subset of cases of issue (b) 
that is fixed now?  I'd like to see an example.

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- 
PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.



More information about the Digitalmars-d-announce mailing list