[Pitch] Effectful Read-only Properties

I know you put lots of work on this and I enjoyed reading the proposal; but overall, I am -1 on the proposal. Swift should provide a way to call async functions from computed properties using @asyncHandler

I agree with you that blocking is not great on a computed property (specially on a UI thread) but if a computed property is blocking then it should not be a computed property imo.

The issue with the Actor's property being reached from outside the Actor should be addressed in the Actor pitch; Worst case we end up with Java style getters that happen to be async throwing. There is also the open question to re-entrancy.

A read-only computed property is a computed property that only defines a get -ter, which can be mutating .

I don't understand this. Can you show an example?

2 Likes