This proposal is very well-written, and the future directions are very well-thought out. It's also a significant improvement from the previous revision.
Before I give my review, I would like to ask for some clarifications:
By default, unapplied references to functions that accept property-wrapped parameters use the wrapped-value type in the parameter list, and the compiler will generate a thunk to initialize the backing wrapper and call the function.
[...]
func log<Value>(@Traceable value: Value) { ... }
[...]
The compiler will generate a thunk when referencing log to take in the wrapped-value type and initialize the backing property wrapper. [...]
{ log(value: Traceable(wrappedValue: $0) }
If the user has already defined a function that takes the entire wrapper storage
func log<Value>(Traceable<Value>) { ... }
(e.g. an existing API like those in SwiftUI that take Binding arguments), would the compiler consider it as an erroneous redeclaration, or does the compiler have a way to work around it to help with migration from older APIs to newer ones that use property wrapper-annotated parameters?
In addition, I would like to add another reason for not supporting passing a property-wrapper storage instance directly: It's ambiguous when the wrapper and wrapped types are the same.
@propertyWrapper
struct Foo { /* ... */ }
func bar(@Foo foo: Foo) { /* ... */ }
let foo = Foo( /* ... */ )
bar(foo) // treat foo as a wrapped value or wrapper storage?
A very much delayed response to 2 posts in the latest pitch thread
I didn't read the proposal in full at the time, and misunderstood the type signature of functions that use property wrapper-annotated parameters. Now that I've finally read the proposal fully, I see that there is nothing dangerous with the function signature. Sorry for this much delayed response.