-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
brain storming idea: implement Eiffel's OO, esp. multiple inheritance, and use it with openmethods #19
Comments
https://forum.dlang.org/thread/obqthozmxwzhvrafothw@forum.dlang.org Challenge Problem:Suppose a person who has both US & UK residence, travel to Paris, and feel ill need to withdraw some money and see a doctor:
I will show the Eiffel program, with the compiler ensures all these constraints: https://github.com/mingwugmail/dlang_tour/tree/master/eiffel/visitor |
Another example, in pseudo D code:https://forum.dlang.org/post/pidvdadmyqceqqkdfkcv@forum.dlang.org On Monday, 28 September 2020 at 19:41:07 UTC, H. S. Teoh wrote:
The Resource A.x in your example is what I have shown in my example PERSON.addr and PERSON.name here: https://forum.dlang.org/thread/obqthozmxwzhvrafothw@forum.dlang.org
... as you can see, all different application semantics can be specified by the programmer. Please check my previous PERSON.addr example more carefully. PERSON.addr https://forum.dlang.org/post/obqthozmxwzhvrafothw@forum.dlang.org |
This is the idea from the discussion:
https://forum.dlang.org/post/ltkcbcwtgrxceesnnxqk@forum.dlang.org
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/obqthozmxwzhvrafothw@forum.dlang.org
https://forum.dlang.org/post/rb4seo$bfm$1@digitalmars.com
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/rb4seo$bfm$1@digitalmars.com
"""
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:
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.
The text was updated successfully, but these errors were encountered: