-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[Proposal] Retroactive protocol refinement #1155
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
Conversation
bee5662
to
006fbee
Compare
006fbee
to
6926458
Compare
Co-authored-by: Yogi <me@yogi.codes>
Co-authored-by: Yogi <me@yogi.codes>
Co-authored-by: Yogi <me@yogi.codes>
Co-authored-by: Yogi <me@yogi.codes>
Co-authored-by: Yogi <me@yogi.codes>
|
||
## Effect on API resilience | ||
|
||
This proposal does not make additions to the public API but is rather is a change to the capabilities of the compiler. |
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.
IIUC, this section is meant to be a discussion of whether/how library authors may use the proposed feature in a resilient library. Specific to this proposal, I think the Effect on API resilience section should communicate whether library authors may add or remove retroactive refinements in an API compatible (and ABI compatible, for libraries built in evolution mode) way.
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.
Thanks for the comment, the proof of concept and resilient protocols is not a good mix indeed you can’t really use the feature to extend the conformances of a protocol in the standard library which is resilient as it needs to know the witness table layout to extend. Ultimately this precludes a lot of use cases even though they may work for now. Can you think of a wording that would capture this?
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.
Is this limitation just a by-product of the current prototype implementation, or is it an inherent limitation of the feature as proposed? If it's the latter, I would say something like,
Retroactive refinement is not available for protocols declared in libraries with evolution mode enabled. If such a retroactive conformance is attempted, the compiler will emit an error of the form "".
I think you should also address the compatibility implications of adding a new retroactive refinement within a resilient library. For instance, the current Library Evolution page has this to say about protocols (among other items):
- New protocol conformances can be added to classes, structs, and enums. (Even if they’re @Frozen.)
- Changes to a protocol’s list of refined protocols are not allowed.
So this section of your proposal should answer the question, "can a resilient library add a retroactive conformance to an existing protocol?". This is subtly different than the question that your comment addresses, which is, "can a client of a resilient library retroactively refine a protocol from that library?". Both questions should be addressed!
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’ve updated the proposal to outline this limitation in more detail.
@@ -0,0 +1,111 @@ | |||
# Feature name |
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.
Name needs updating :)
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.
Thanks, David, I've updated it. Its not like the proposal is going anywhere anyway 🙂
The Language Workgroup is trying to be better about not allowing proposals to sit for long periods without making progress. Unfortunately, this PR has fallen into that state, and it's not clear to us that anyone is still actively engaged with it. I am closing it as stale, but that's not a judgment on the underlying proposal; please feel free to reopen it if you're interested in bringing it through evolution. This proposal will also need extensive implementation feasibility review. |
Hi Apple,
A proposal for this feature that is mentioned in the generics manifesto given that attempts at an implementation are now showing fruit.