[Accepted] SE-0310: Effectful Read-only Properties

Hello Swift Community,

The review of SE-0310 Effectful Read-only Properties concluded on April 27, 2021. The proposal is accepted.

The Core Team considered a number of points that came up in the discussion:

  • There was some discussion about the placement of effects specifiers (async and throws), with a request to move the specifiers to the property declaration itself rather than being specified on the getter. The proposal author has clarified why the proposed syntax is the appropriate syntax. The proposal will be amended with this rationale.
  • It was noted that further extension of effects to writable properties would make it hard for users to separate the getter and setter declarations:
protocol P {
  var p2: Int { get async throws nonmutating set }
}

This is an existing issue in the language (e.g., get nonmutating set) that does not directly impact the feature as proposed, so this proposal does not need to address it directly. However, the Core Team would like to see a separate proposal that introduces the ability to separate the accessors explicitly.

Thank you to everyone who participated in the review and pitches!

Doug Gregor
Review Manager

20 Likes