I wasn’t asking to get something like this now. I was curios and I don’t feel like curios question like this should be asked in the user mail-list. Maybe we need an extra mail-list for discussion and this will only remain for proposals and review, which will sort out such additional topics and don’t bother the review process.
After I posted the question I realized myself that the given example will only work for generics with a single inner type. That’s why you’re totally right about the ability without specialization. :) The next problem you’re design, that it does not work with structs and enums. -- Adrian Zubarev Sent with Airmail Am 18. Juli 2016 um 09:17:44, Charlie Monroe ([email protected]) schrieb: In general, Swift will need a way to point to a generic type without a particular specialization. Currently, you can't do this: class APICall<T> { } class CombinedCall: APICall<Bool> { var calls: [APICall] // Error - no specialization } I've been currently working around this by: class APICallBase {} // No generics class APICall<T>: APICallBase {} class CombinedCall: APICall<Bool> { var calls: [APICallBase] } But it's definitely a pain to work with. As asked by the core team several times now, we should defer any discussion on additional features until August. On Jul 18, 2016, at 9:04 AM, Adrian Zubarev via swift-evolution <[email protected]> wrote: This is something additional, but I’m curios about how the community feels about it. I recently come across the issue where conforming to Hashable wasn’t enough to thecke if two instances of the same generic type were equal. I had additionally provide myself the != function. public func !=<T, U>(lhs: SomeTypeName<T>, rhs: SomeTypeName<U>) -> Bool { return lhs.hashValue != rhs.hashValue } I wondered if Swift can ever get generic specialization like this: public func !=<T : Hashable, U, V>(lhs: T<U>, rhs: T<V>) -> Bool { return !(lhs.hashValue == rhs.hashValue) } This function in stdlib would fill the gap. Or we need an extra protocol GenericHashable which includes !=. -- Adrian Zubarev Sent with Airmail _______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
