> On 22 Nov 2016, at 04:18, Ramiro Feria Purón via swift-evolution 
> <[email protected]> wrote:
> 
> Thanks Dave!
> 
> As another example, consider it as part of this common pattern:
> 
> class A<T> {
>     init() {
>         // ..
>     }
> }
> 
> class B<T>: A<T> {
>     override init() {
>         // ..
>     }
> }
> 
> class Factory {
>     
>     class func makeA<T>() -> A<T> { return B<T>() }
>     //..
> }
> 
> Factory.makeA<Int>()

You can still do this using one of the following:

        class Factory {
                class func makeA<T>(_ theType:T.Type) -> A<T> { return B<T>() }
        }
        let foo = Factory.makeA(Int.self)

        class Factory<T> {
                class func makeA() -> A<T> { return B<T>() }
        }
        let foo = Factor<Int>.makeA()

i.e- we already have the tools to do this; in the form of inference, passing 
the type, and adding the generic to the type itself. I guess I'm just not 
seeing a clear advantage that the proposed syntax adds except to allowing 
dropping of .self on the pass-the-type form of call.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to