DMD 0.150 release

xs0 xs0 at xs0.com
Tue Mar 21 15:27:10 PST 2006


Walter Bright wrote:
> "xs0" <xs0 at xs0.com> wrote in message news:dvpgtm$ua2$1 at digitaldaemon.com...
>> 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 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. 

Hmm, so casting between FooInterface[] and FooClass[] still doesn't 
work, right? Are you sure that's better than spending a few cycles per 
method call? Furthermore, some common operations would actually be faster:

- returning interfaces from functions :)
- calling methods defined in Object
- testing for equality

BTW, the spec should say something on that matter, I think you should 
either make the array casting work or declare it illegal, as an invalid 
reference is utterly useless. At least one will get a nice error message 
instead of a big "WTF?!?" expression on his face, when he tries to call 
a method :)


xs0



More information about the Digitalmars-d-announce mailing list