Add info about protocols with superclass requirement [SE-0156]#447
Add info about protocols with superclass requirement [SE-0156]#447valeriyvan wants to merge 5 commits into
Conversation
|
Thanks for taking the time to write up this addition to the documentation! Overall, I think these changes look good, but we should work through a couple minor questions. This looks like the correct place to discuss this in the guide. Adding a code listing is good also, to match the existing tone of the docs in this chapter, and to show the syntax in an approachable way. Can we find a less contrived example? The What updates should we make to the reference? I don't see this syntax discussed in Protocol Declaration. If you'd like, I can write a draft of the changes there, or I can defer to you. As a minor processes question, was this syntax new in SE-0156? I see discussion in that proposal of protocol composition, but not of this being newly allowed. Because of the similarities between conformance to a protocol and subclassing a superclass, I'm guessing this syntax might predate the Swift Evolution process. If it's not from that proposal, let's remove the SE number from the PR name. @hborla Can you help identify a technical reviewer for this PR? CC @invalidname who will be working on Swift docs when I'm out of the office starting sometime next month. |
SE-0156 didn't introduce new syntax but new semantics allowing existential to have specific class requirements: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0156-subclass-existentials.md#proposed-solution. |
I have applied minimal changes into Declarations.md as well. Please review. |
Updated example. Please have a look. |
|
@amartini51 please review recent changes |
Formatting the body across multiple lines matches the way functions and initializers are formatted elsewhere in the guide.
amartini51
left a comment
There was a problem hiding this comment.
Thanks for your patience while I was out on new-parent leave! This revised code listing looks good now. I'll follow up again to get a technical reviewer to look at these changes.
I pushed two minor/mechanical changes to your PR, and noted one paragraph in the reference that I don't think needs to be added.
| This is more restrictive than using `AnyObject` | ||
| because it limits conformance to a specific class hierarchy | ||
| rather than to any class type. | ||
| For more information, | ||
| see <doc:Protocols#Class-Only-Protocols>. |
There was a problem hiding this comment.
I don't think you need this paragraph. The reference doesn't follow the three-part "intro, code listing, walkthrough" format that the guide uses. The reference generally doesn't link to the guide, except in places where only the chapter in the guide has the full information.
Add info about protocols with superclass requirement.
Fixes: #445
Fixes: rdar://171309018