Despite this paragraph in SE-0296, it looks like properties with async getter are supported in the end, with Task.value
as an obvious example.
Rationale : Properties and subscripts that only have a getter could potentially be
async
. However, properties and subscripts that also have anasync
setter imply the ability to pass the reference asinout
and drill down into the properties of that property itself, which depends on the setter effectively being an "instantaneous" (synchronous, non-throwing) operation. Prohibitingasync
properties is a simpler rule than only allowing get-onlyasync
properties and subscripts.
Do I understand correctly that raised concerns do not apply to non-mutating setters, including setters in the class properties? They don't require self
to be passed inout
, so technically this restriction could be lifted in the future. I don't have any motivational examples, just curious.