-
Notifications
You must be signed in to change notification settings - Fork 8
Description
This is the idea from the discussion:
https://forum.dlang.org/post/[email protected]
Background:
Although D intendeds to have single-inheritance with multiple interfaces, but the multiple inheritance problems have crept into D already, because of the introduction of mixin and (multiple-) alias this, which caused many unsolvable troubles in current D.
Actually the diamond problem is a solved problem by Eiffel language, which won the 2006 ACM Software System Award:
https://en.wikipedia.org/wiki/ACM_Software_System_Award
And I showed the concrete example here:
https://forum.dlang.org/thread/[email protected]
https://forum.dlang.org/post/[email protected]
The two hallmarks of Eiffel, is design-by-contract and multiple inheritance, which is known in academics (in my former life).
it's a pity that
D only picked design-by-contract from Eiffel, but throw away multiple inheritance,
... and instead introduced sub-typing, mixin,
which Walter said:
https://forum.dlang.org/post/[email protected]
"""
The trouble was, it was inserted without realizing it was multiple inheritance, meaning its behaviors are ad-hoc and don't make a whole lot of sense when examined carefully.
"""
Proposal:
On Tuesday, 29 September 2020 at 09:56:47 UTC, Petar Kirov [ZombineDev] wrote:
I think one extravagant, but definetely workable solution would be create a template DSL (ofc it could also be string mixin-based) in D to prototype a multiple
inheritance system (with e.g. the Eiffel featuresrename,export,undefine,redefine/override, andselect). Being just a prototype, it should be acceptable to go with custom functions likeisSubTypeOf,asBaseType, etc., instead of using the built-in language syntax and semantics. (Sort of like https://code.dlang.org/packages/openmethods adds multiple dispatch.)
This is an interesting idea, basically implement the Eiffel compiler (the OO part) as a D library, and perhaps also use openmethods, then we will have a Lisp's multi-methods + Eiffel OO inheritance.
I'm not sure how complex this implementation is going to look like.