Key Path Expressions as Functions

I was wondering if this proposal is accepted that we can potentially extend a similar behavior to propery functions like get, set etc.

Would you consider this as a future direction?

public struct Something {
  private var storage: Storage = ...
  
  // overriding get/set functions
  public var property: Value {
    get(\.storage.value)
    set(\.storage.value)
  }

  // or unified version of get/set
  // not sure if `inout` would be correct
  public var property: Value {
    inout(\.storage.value)
  }
}
8 Likes