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

Error in Protocol Initializer Declaration text or its grammar #267

Open
tadbyt opened this issue Feb 5, 2024 · 0 comments
Open

Error in Protocol Initializer Declaration text or its grammar #267

tadbyt opened this issue Feb 5, 2024 · 0 comments

Comments

@tadbyt
Copy link
Contributor

tadbyt commented Feb 5, 2024

Location

https://docs.swift.org/swift-book/documentation/the-swift-programming-language/initialization#Initializer-Inheritance-and-Overriding
https://docs.swift.org/swift-book/documentation/the-swift-programming-language/declarations#Protocol-Initializer-Declaration
https://docs.swift.org/swift-book/documentation/the-swift-programming-language/declarations#Initializer-Declaration

Description

Either there is an error in the Grammar of a protocol initializer declaration or there is an error in the text of the Protocol Initializer Declaration subsection as they are currently inconsistent. The second sentence in the first paragraph reads:

Protocol initializer declarations have the same form as initializer declarations, except they don’t include the initializer’s body.

The problem is that async is an optional modifier in an initializer declaration, but not for an initializer requirement. Discussion in the Initialize Inheritance and Overriding subsection of the Initialization section does mention asynchronous initializers, so the issue is whether an initializer requirement can specify an asynchronous initializer or not.

Correction

If an initializer requirement can specify an asynchronous initializer, then each of the two protocol-initializer-declaration productions need to have async ? inserted following parameter-clause.

If not, then the aforementioned sentence needs to be modified to:

Protocol initializer declarations have the same form as initializer declarations, except they don’t include the initializer’s body and can't specify an asynchronous initializer.

@tadbyt tadbyt changed the title Error in Protocol Initializer Declaration, Initialization Declaration, or one of their grammars Error in Protocol Initializer Declaration text or its grammar Feb 5, 2024
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

No branches or pull requests

1 participant