You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
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.
The text was updated successfully, but these errors were encountered: