Multiple Inheritance of Classes
Chris R. Miller
lordSaurontheGreat at gmail.com
Tue Aug 12 12:30:21 PDT 2008
Lars Ivar Igesund wrote:
> Chris R. Miller wrote:
>> Understand, I'm NOT demanding ANYTHING.
>>
>> What is the current state of thought about Multiple Inheritance for
>> classes in D? I'd like to have that feature, since it'd make some stuff
>> I want to do a bit easier. Is it not there because it's not worth the
>> effort to implement? Because it's evil and needs to die (I don't know,
>> some people could possibly be adamantly anti-MI)?
>
> This is actually the reason, not the adamantly anti-MI part, just that MI is
> evil and that is well acknowledged almost everywhere. You will find good
> argumentation against it if you look, too.
Looking at superdan's message, gee whiz, that didn't take long to find
the implementational reasons against it.
Reading about next-gen compilers like LLVM it makes me wonder with all
that run-time type inferencing gizmo gadgetry available at virtually no
cost, will this make MI (for those who want it) more feasible to
implement? Hmm, a curious possibility to consider. LLVM is supposed to
be wicked fast, too. My Apple friend tells me that most of OS X's GL
stack is built with LLVM for speed. There might be something to it.
>> I don't know. I know
>> I can add a lot with mixins, but I'd just like to know what the state of
>> the feature is.
>>
>> The reason is I was trying to explain how cool D is to some other
>> friends of mine, and they asked about Multiple Inheritance (of classes)
>> and they were sort of put off by it's lack of it. Then again, he was an
>> Objective-C programmer... ;-)
>
> In the languages where MI is possible, it usually also is possible to not
> shoot your own foot with some care, in which case it can appear as a
> powerful feature. But almost everywhere it just is a very bad idea, and you
> will find it is banned in many projects for languages allowing it (like
> C++).
Look long enough and you can find anything. ;-)
I see your point though.
>> So please don't take offense, since none is meant, I just wanted to know
>> what I could hope for in the future.
>
> You should hope you can redesign your application to not need MI ;)
Yeah, it's trivial to work around it (I did come from Java!) but some
bits and pieces seem like it would be better if they could inherit
behavior and data, not just a contract. It could be done through a
mixin, but that defeats the polymorphism I want present in the design.
And a Mixin and an interface just seems clunky. What if I do the mixin
but forget the interface, or vice-versa? Yuk! Though it would give me
the option of re-implementing it differently if necessary... a curious
silver lining.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20080812/6f59b679/attachment.pgp>
More information about the Digitalmars-d
mailing list