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

Update for async and throwing getters [SE-0310]

Open jansorg opened this issue 1 year ago • 3 comments

Description The changes listed in SE-0310 are not contained in the official language specification.

getter-effects → "throws"
getter-effects → "async" "throws"?

Rules getter-clause and getter-keyword-clause are missing the getter-effects rule in the current spec:

getter-clause  → attributes? mutation-modifier? "get" getter-effects? code-block
getter-keyword-clause → attributes? mutation-modifier? "get" getter-effects?

I couldn't figure out if the spec is on GitHub. If you point me to it, I'd be glad to make the change.

rdar://77234189

jansorg avatar Jul 27 '23 19:07 jansorg

@jansorg The language reference is maintained in the https://github.com/apple/swift-book repository.

@hamishknight Please transfer this issue.

AnthonyLatsis avatar Jul 27 '23 20:07 AnthonyLatsis

cc @amartini51

hamishknight avatar Jul 27 '23 20:07 hamishknight

Copying my initial assessment of documentation impact from rdar://77234189 below. Updated the title because it's not just the grammar that needs to be updated.

In the Properties > Computed Properties section (1) we should add a forward reference to the fact that getters can be async and throw. In the Error Handling chapter, we'd want a section about throwing getters parallel to the existing section (2) about throwing functions. In the Concurrency chapter, we can probably mention async getters in passing in the section (3) about async functions.

1: https://docs.swift.org/swift-book/LanguageGuide/Properties.html#ID259 2: https://docs.swift.org/swift-book/LanguageGuide/ErrorHandling.html#ID510 3: https://docs.swift.org/swift-book/LanguageGuide/Concurrency.html#ID639

amartini51 avatar Oct 03 '23 22:10 amartini51