swift-book icon indicating copy to clipboard operation
swift-book copied to clipboard

Add more existentials documentation

Open ldct opened this issue 1 year ago • 4 comments

This PR contains a few changes to add more documentation around existentials. Note that the "Protocols" chapter comes before the "OpaqueTypes" chapter.

  • Expand the section Protocols as Types with other examples of using protocols as types
    • Personally I think these are a more common than "as a generic constraint", and hence deserve some elaboration
  • Explicitly call the result of protocol composition a Protocol Composition Type.
    • Prior to this PR, the result does not have an explicit name in the Language Guide. Protocol Composition Type is the named used by the Language Reference.
    • The Generics chapter implicitly uses the name Protocol Composition for this. In my mind, this is a short form.
  • Explicitly say that existentials can use protocol composition types.
  • Delete the "opaque type" section in the protocols chapter. The same material seems to be present in the OpaqueTypes chapter.

ldct avatar Nov 21 '24 05:11 ldct