Isn't the solution to a lot of these issues allowing explicit generalization 
instead of this meta type business?

> On 22 Jul 2016, at 17:03, Anton Zhilin via swift-evolution 
> <swift-evolution@swift.org> wrote:
> 
> 2016-07-22 17:32 GMT+03:00 Karl <razie...@gmail.com>:
>> I wouldn’t be surprised if there are less than a handful of people outside 
>> of the Swift team who understand what .Protocol means. 
>> 
>> Most of us just want to create generic objects based on their conformance to 
>> an initialiser in a protocol:
>> 
>> protocol Constructable {
>>      init()
>> }
>> 
>> func construct<C:Constructable>() -> C {
>>      return C()                                               // ERROR
>> }
> 
> In your example, there is no problem, because we can disambiguate based on 
> return type:
> 
> let c = construct() as SomeConstrictible
> 
> Metatypes are only really needed, when target type would not appear in the 
> signature otherwise.
> And I kind-of understand the decision of not adding explicit generic function 
> specialization, because otherwise there would be double specialization in 
> generic constructors, like this:
> 
> struct Example<T> {
>     init<U>()
> }
> Example<Int><Double>
> 
> And that would look awful. If I'm not mistaken, such initializers exist in 
> the standard library.
> _______________________________________________
> swift-evolution mailing list
> swift-evolution@swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to