Navigation Menu

Skip to content
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

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

Merged
merged 31 commits into from May 26, 2023

Conversation

amartini51
Copy link
Collaborator

  • 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.
TSPL.docc/LanguageGuide/OpaqueTypes.md Outdated Show resolved Hide resolved
TSPL.docc/ReferenceManual/Types.md Outdated Show resolved Hide resolved
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:

TSPL.docc/LanguageGuide/Protocols.md Outdated Show resolved Hide resolved
TSPL.docc/LanguageGuide/Protocols.md Show resolved Hide resolved
TSPL.docc/LanguageGuide/Protocols.md Outdated Show resolved Hide resolved
TSPL.docc/LanguageGuide/Protocols.md Show resolved Hide resolved
amartini51 and others added 4 commits February 23, 2023 13:47
Co-authored-by: Xiaodi Wu <13952+xwu@users.noreply.github.com>
Co-authored-by: Ben Rimmington <me@benrimmington.com>
DocC link syntax follows the destination title, not its filename.  The
chapter part is in UpperCamelCase and the heading is in Upper-Kebab-Case.
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.

TSPL.docc/LanguageGuide/OpaqueTypes.md Show resolved Hide resolved
TSPL.docc/LanguageGuide/OpaqueTypes.md Show resolved Hide resolved
TSPL.docc/LanguageGuide/Protocols.md Outdated Show resolved Hide resolved
TSPL.docc/LanguageGuide/Protocols.md Outdated Show resolved Hide resolved
TSPL.docc/LanguageGuide/Protocols.md Outdated Show resolved Hide resolved
TSPL.docc/LanguageGuide/Protocols.md Show resolved Hide resolved
Co-authored-by: Chuck Toporek <chuck_toporek@apple.com>
@amartini51 amartini51 merged commit 01c93c9 into apple: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.

None yet

6 participants