> I have completed a first draft of a proposal to introduce automatic protocol 
> forwarding.  I’m looking forward to feedback from everyone!

Some things I don't see discussed here:

* Does it have to be a protocol? Why not also allow the concrete type of the 
property you're forwarding to? Obviously you couldn't form a subtype 
relationship (unless you could...), but this might be useful to reduce 
boilerplate when you're proxying something.

* Why the method-based conversion syntax for return values, rather than 
something a little more like a property declaration?

        var number: Int
        forward IntegerType to number {
                static return(newValue: Int) {
                        return NumberWrapper(newValue)
                }
                return(newValue: Int) {
                        return NumberWrapper(newValue)
                }
        }

* If you want to keep the method-based syntax, why use the `init(_:)` 
initializer instead of one specifically for forwarding, like 
`init(forwardedReturnValue:)`?

* If you want to keep the method-based syntax, why do all forwards, even to 
different members, share the same transformation method? Wouldn't it be better 
to have, for instance, `init(returnedNumber:)` and 
`transformedReturnedNumber(_:)`, so that forwards to other properties could use 
different logic?

* If you want to keep the method-based syntax, would it make sense to instead 
have an initializer for instance initializers too, and just have it take a 
second parameter with the instance?

        init(forwardedReturnValue: Int) {...}
        init(forwardedReturnValue: Int, from: NumberWrapper) {...}

* Does this mean that a `public forward` declaration would forward `internal` 
members through synthesized `public` interfaces, if the forwarder and forwardee 
happened to be in the same module?

> All synthesized members recieve access control modifiers matching the access 
> control modifier applied to the forward declaration.


* You don't explicitly mention this, but I assume mutating methods work and 
mutate `self`?

-- 
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to