| |
 | Posted by Frits van Bommel in reply to Scott S. McCoy | Permalink Reply |
|
Frits van Bommel 
Posted in reply to Scott S. McCoy
| [fixed upside-down post]
Scott S. McCoy wrote:
> On Sun, 2008-03-30 at 23:25 +0200, Frank Benoit wrote:
>> COM is the only reason I am aware of, why interfaces are not implicit compatible to to object.Object. But COM is a very special case which probably can get a special solution?
>>
>> How about making /IUnknown/ a special interface without this compatibility and have all interfaces, not derived from IUnknown be compatible to Object?
> It is kind of curious why interface typed identifiers don't implicitly cast to Object, and you must explicitly cast.
>
> But regardless of the reason, adopting a convention (and a bad one at that) such as prefixing interfaces with "I" probably shouldn't be done at the language level. And even more, D already has avoided creating any kind of special types (you can throw Object, for instance, and it's not a derivative of /Exception/) so far as I can tell...why start now?
He didn't propose handling interfaces starting with 'I' differently. He proposed handling interfaces derived from IUnknown differently. They're already treated differently[1], but he wanted to change the behavior of other interfaces without adding the same change to IUnknown-derived interfaces (since it wouldn't work there[2]).
[1]: See the last part of <http://www.digitalmars.com/d/1.0/interface.html>.
[2]: Objects referred to by COM interface references (see [1]) may be implemented in a different language than D, and so may not be compatible with the D Object class at all.
|