[swift-evolution] [Pitch] Retiring `where` from for-in loops

Austin Zheng austinzheng at gmail.com
Tue Jun 14 03:28:45 CDT 2016


> On Jun 14, 2016, at 1:22 AM, Haravikk via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On 14 Jun 2016, at 07:54, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> And a language feature being undocumented wouldn't explain why the entire stdlib uses it only three times :)
> 
> I sometimes wonder whether the stdlib is always the best example of pure Swift coding practices, it has after all been developed while the language itself is in flux so chunks of it were being written while language features were actively changing, and it has a lot of patterns in it that I just don’t use in Swift. For example, I still haven’t figured out why the Indexable protocol has an IndexableBase parent (other than to make figuring out why my types don’t conform a lot harder),

AFAIK this is because associated types currently can't define a recursive protocol conformance constraint. For example, `SignedIntegerType` has a `Distance` associated type which should also be a `SignedIntegerType`, but has to be implemented using a shadow protocol (`_SignedIntegerType`) instead.

> and there’s stuff going on in .gyb files that remains a mystery to me. There’s also a lot of little hidden features that we don’t have access to in our own code (I can't find a method that retrieves object identifiers, for comparing two types without knowing what they are, outside of the stdlib for example, yet you’ll find them used inside AnyIndex and similar types).

Is the publicly exposed `ObjectIdentifier` type what you're looking for?

> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list