The various tradeoffs were covered more in-depth in the previous review thread, but to summarize my personal distaste for exposing the storage-typed version of the function automatically:
- It breaks with the current precedent that backing storage is private, and does so in a non-obvious way. Library authors may not realize that they are exposing API which traffics in the storage type.
- It makes the addition/removal of a function-argument-wrapper attribute a potentially source-breaking change.
- It prohibits the use of initializer arguments in the wrapper attribute. There's no point in declaring a wrapper as
@Asserted(.greaterOrEqual(1))if any client can simply pass an
Assertedinstance with a completely different validation.
- It removes API control from both the property wrapper author and the author of the wrapped-argument function.