[swift-evolution] [Discussion] Type hierarchy translation consistency

Adrian Zubarev adrian.zubarev at devandartist.com
Sat Jun 11 10:02:09 CDT 2016

Is this some wrong api translation or something?

extension String {

    /// The index type for subscripting a string.
    public typealias Index = String.CharacterView.Index

    /// A type used to represent the number of steps between two `String.Index`
    /// values, where one value is reachable from the other.
    /// In Swift, *reachability* refers to the ability to produce one value from
    /// the other through zero or more applications of `index(after:)`.
    public typealias IndexDistance = IndexDistance
IndexDistance = IndexDistance really?

Shouldn’t this look like

public typealias IndexDistance = public typealias IndexDistance = String.CharacterView.IndexDistance?
Don’t get me wrong, Xcode is able to tell me that by cmd+click in the right IndexDistance but this translation is ugly.

Otherwise I also could write

public typealias Index = Index
which looks very ugly.

Is this a bug? Current snapshot bug?
Should we propose for more consistency or is this something that the devs are working on?

Adrian Zubarev
Sent with Airmail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160611/fec337cc/attachment.html>

More information about the swift-evolution mailing list