If there is a function like this:
func serialize<T>(continuation: GenericWithLongName<T, NSError> -> Void) -> VoidDoing this is wrong:
serialize<SomeType> { obj in ... }Doing this is ugly:
serialize { (obj: GenericWithLongName<SomeType, NSError>) -> Void in ... }And the workaround is:
func serialize<T>( t: T.Type, continuation: GenericWithLongName<T, NSError> -> Void ) -> Void { }
serialize(SomeType.self) { obj in ... }I feel that workaround is not perfect. It abuses the semantic of input parameter because t is not used in runtime. It's just a hint for type inference.
And the use of SomeType.self makes it a little bit harder to read code, as the meaning of .self attribute is not so intuitive.
Since Xcode will give clear error message when specializing generic explicitly, while specializing generic for class explicitly is allowed, I think it's a designed feature. But is there any negative implication from allowing explicitly specialization?