[swift-dev] RFC: Adding Optional variants of == for collections to the std lib
John McCall
rjmccall at apple.com
Sat Dec 5 15:18:29 CST 2015
> On Dec 5, 2015, at 12:39 PM, Martin Kühl via swift-dev <swift-dev at swift.org> wrote:
> On 5 December 2015 at 16:38, Paul Young <paulyoungonline at gmail.com> wrote:
>>
>> I’d like to get a sense from contributors to the standard library if they feel that the functionality in https://github.com/paulyoung/OptionalEquatableCollection has a place there.
>>
>> The project provides Optional variants of the existing implementations of the "equal to” operator (==) for Array, Dictionary, and Set.
>>
>> My question is more concerned with the overall concept as opposed to my particular implementation.
>
>
> Wouldn’t this be solved automatically if collections of Equatable
> could conform to Equatable themselves?
> I.e. if this were valid
>
> extension Array: Equatable where Element: Equatable
>
> then we wouldn’t need more special cases for (combinations of)
> containers of Equatable elements, like the collection types currently
> are.
Yes. This is an obvious limitation of the current system that we are eager to fix. Unfortunately, it is blocked by deficiencies at several levels, most visibly (to us, at least) at the IRGen / metadata layer. Addressing those is a priority for many reasons, but specifically unblocking this feature is one of them.
John.
>
> (see also rdar://23433955)
>
> Martin
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev
More information about the swift-dev
mailing list