-
Notifications
You must be signed in to change notification settings - Fork 93
Define term "derived interface" #680
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
base: draft-v8
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but would appreciate others reviewing before we merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM @RexJaeschke
Let's :shiopit:
|
I will disagree in ~30min (sorry on a call)
… On 6/12/2022, at 6:54 am, Bill Wagner ***@***.***> wrote:
@BillWagner approved this pull request.
This LGTM @RexJaeschke <https://github.com/RexJaeschke>
Let's :shiopit:
—
Reply to this email directly, view it on GitHub <#680 (review)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABSYVW3TUX4L3YHDLMVGW3TWLYT3RANCNFSM6AAAAAASUFYJZM>.
You are receiving this because you are subscribed to this thread.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to recommend this is made a draft and left until we have looked at the default member implementations.
C# (originally?) is a single inheritance language which adopted the CLI model that interfaces no not inherit but rather the "base" interface list is a list of "adopting classes must also implement".
IIRC even the use of the word "inherit" in §18.1 "An interface may inherit from multiple base interfaces" was debated…
In the Annotated Standard there are annotations explaining that interface "inheritance" is not the same as class inheritance.
Now default member implementation may to change how we describe this going forward, but I think we need to look at it and make sure the Standard is really clear on what "derived" means in this case.
On a minor point the current text defines every interface as a derived one – as it only may have base interfaces and surely to be derived you need 1 or more.
|
This PR targets "draft-v7", but its milestone is set for V8. We should resolve that. |
|
@BillWagner Initially, this was intended to change draft-v7, and I probably had that as the milestone. However, Nigel proposed we defer this until we deal with “Default member implementations in interfaces” in v8, so I changed the milestone to v8. What are our options w.r.t GitHub? Can we change the base from v7 to v8, or do I need to close this PR and create one against v8 instead? |
|
I changed the base branch from |
b01cc0e to
55f0639
Compare
|
rebased on the latest draft v8 on 09/25/2023 |
|
Let's reconsider in the light of #681. |
|
Inheritance is a property of the enclosing types. One doesn't "inherit members". |
|
I've thought of "inherits" or "derives from" as meaning to create a new type and base it on an existing type (or types) in such a way that the defining aspects of the base type (or types) are present in the new type. A class would not be able to inherit from an interface, because interfaceness is a defining aspect of the base type, and a class does not have interfaceness. But a class could inherit from a class, and an interface could inherit from an interface. |
|
I also strongly believe that the spec is not made better by avoiding common parlance, when the common parlance is perfectly specific. The de facto term for |
|
A quarter of a century ago – which in computer science terms is eons! – the type models of the CLI & C# were co-developed and it is in that history that the term derived interface comes from, it is worth looking back. The last CLI Standard came out in 2012, the last C# for v7 in 2023, both pre-date the inclusion of implementation in interfaces. From the CLI Standard:
The difference here between object inheritance and interface derivation is the model that C# v7 describes. Up until this point the use of “inheritance” for both was probably unfortunate, even if common parlance; now of course interfaces can contain implementations and further an interface can provide an implementation for a different interface, i.e. provide a default implementation for a method from one of the interfaces it derives from through an explicit implementation. The challenge for C# v8 and onwards is to change the description of interface derivation, or whatever it is now to be called, to cover implementations in interfaces – it is still not the same as class inheritance in C#, which is a single-inheritance system, and so calling it something other than “inheritance” or always qualifying it as “interface inheritance” might be required. There is no CLI Standard to fall back on for this specification. When it is known that v8 has the new model correctly specified, if it doesn’t already, then defining (and renaming?) derived interface should fall out… (Famous last words!) |
The C# spec defines the terms base class, derived class, and base interface, but not “derived interface.” However, it uses the term “derived interface” or “derived [type] member” a few times.
As I complete the spec for the V8 feature, “Default member implementations in interfaces,” I will add more uses of the term “derived interface.”