> On Jan 12, 2017, at 1:37 PM, Slava Pestov via swift-evolution > <[email protected]> wrote: > >> Before I submit it, could someone let me know if adding generics to >> subscripts would influence the ABI? ( still feel pretty clueless in that >> area). > > It won’t change the ABI of existing subscript calls, but if the standard > library introduces new generic subscripts that replace older non-generic > subscripts, it will impact ABI. >
Specifically, we currently have to have a _Hashable protocol that has a _toAnyHashable() method in order to implement Dictionary<AnyHashable,*> subscripting using concrete types as keys. A replacement subscript that was generic over all Hashable types would solve this more neatly, and would be source-compatible, but affects the ABI of the stdlib. https://github.com/apple/swift/blob/master/stdlib/public/core/Hashable.swift#L16 Generic subscripts would also make it easier to implement one-sided ranges e.g. myCollection[i...] // slice from i to the end
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
