[Pitch #3] SE-0293: Extend Property Wrappers to Function and Closure Parameters

I would say "yes" if we don't drop the following requirement:

With a required init(wrappedValue:) (or init(wrappedValue:params:)) the function type signature is preserved, so it makes sense to satisfy a protocol requirement. Users would also be free to add or remove property wrappers to their function parameters with no effects other than the ability to use the projected value in the function body.

Without that requirement, we should probably need a specific error: the general

Type 'S' does not conform to protocol 'P'
Do you want to add protocol stubs?

would add a separate function with apparently the same type signature of the original, but with all the property wrappers removed. That may be confusing.


Currently, property wrappers cannot be declared in protocols. Are you referring to subclassing only?

FWIW, result builder variables/parameters are allowed to be overridden by non-result builder properties/parameters, but I don't know if it was explicitly intended to work this way.


From the user perspective, the Wrapper type will never be considered. Also, the backing function will be unreachable, so if a function with the same type signature of the backing one exists, it wouldn't conflict.