Skip to content

brain storming idea: implement Eiffel's OO, esp. multiple inheritance, and use it with openmethods #19

@mw66

Description

@mw66

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 features rename, export, undefine, redefine / override, and select). Being just a prototype, it should be acceptable to go with custom functions like isSubTypeOf, 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions