Skip to content

Update discussion of boxed protocol types [SE-0335] #103

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

Merged
merged 31 commits into from
May 26, 2023

Conversation

amartini51
Copy link
Member

  • In the Protocols chapter, replace the discussion of existentials with a summary of the ways you can use a protocol as a type, linking forward to the full discussions of generics and existentials and opaque types.
  • Move the discussion of existentials from Protocols to Opaque Types, renaming that chapter to Opaque and Boxed Types.
  • Add a new Boxed Protocol Type section in the reference, to discuss the any keyword.

Pitch thread: https://forums.swift.org/t/61665

Fixes rdar://88208011

Conflicts in:

- Sources/TSPL/TSPL.docc/LanguageGuide/Protocols.md
- Sources/TSPL/TSPL.docc/ReferenceManual/Types.md

Kept the @comment to <!-- --> change from 'main' and the addition of a
new syntactic category from this branch.  Forwarded the changes on
'main' to content that moved into BoxedProtocolTypes.md here.
This effectively reverts commit a17a3dd and takes a different approach.
Incorporates feedback from Xiaodi Wu (@xwu) from the pitch thread.
Avoiding a variadic function arguments keeps the syntax a little
simpler, and using the array of boxed Shape types in a wrapper type
matches the flow of the other examples in the chapter.
Confirmed that the replacement text illustrates the same functionality.
Changes to TSPL.docc/LanguageGuide/Protocols.md on 'main' deleted stray
whitespace in the Dice exampple, and this branch's changes deleted that
example.
@amartini51 amartini51 requested a review from hborla February 22, 2023 22:21
Copy link
Contributor

@benrimmington benrimmington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the "Protocols as Types" section:

amartini51 and others added 4 commits February 23, 2023 13:47
Co-authored-by: Xiaodi Wu <[email protected]>
Co-authored-by: Ben Rimmington <[email protected]>
DocC link syntax follows the destination title, not its filename.  The
chapter part is in UpperCamelCase and the heading is in Upper-Kebab-Case.
@amartini51 amartini51 requested a review from chuckdude April 21, 2023 00:15
Copy link
Contributor

@chuckdude chuckdude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor edits; approving with changes.

Co-authored-by: Chuck Toporek <[email protected]>
@amartini51 amartini51 force-pushed the existential_any_88208011 branch from c704437 to 4754b42 Compare May 1, 2023 20:30
@amartini51 amartini51 merged commit 01c93c9 into swiftlang:main May 26, 2023
@amartini51 amartini51 deleted the existential_any_88208011 branch May 26, 2023 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants