And the rest of the thread.
Such design would also allow us to create property wrappers for computed properties.
One use case I have in mind:
extension EnvironmentValues {
enum ValueKey: EnvironmentKey {
static var defaultValue: Value { ... }
}
// before
var value: Value {
get {
self[ValueKey.self]
}
set {
self[ValueKey.self] = newValue
}
}
// `Wrapper` is a static property wrapper which does not require any storage.
// after
@Wrapper(ValueKey.self)
var value: Value
}
I would be against rushing to "complete" property wrappers any time soon, as this will dramatically change the design and property wrappers potential. I would like to encourage the community to push other language features that would make PW's even more powerful first.