Dictionary subscript extension without Index

Could be better. Should match objects.keyed(by: \.id).

final class Object: Identifiable { }
let object = Object()
var dictionary: [Object.ID: Object] = [:]
dictionary.set(object, for: \.id)
#expect(dictionary[object.id] === object)
extension Dictionary {
  mutating func set(_ value: Value, for getKey: (Value) -> Key) {
    self[getKey(value)] = value
  }
}