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

Adrian Zubarev adrian.zubarev at devandartist.com
Sun Jun 12 05:33:05 CDT 2016


Just looked up the current implementation of this:

extension String {
  /// The index type for subscripting a string.
  public typealias Index = 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 = CharacterView.IndexDistance
So the whole thing is somehow a wrong translation I’d guess.

Should I file a bug?



-- 
Adrian Zubarev
Sent with Airmail

Am 11. Juni 2016 um 17:02:15, Adrian Zubarev (adrian.zubarev at devandartist.com) schrieb:

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/20160612/18b6e656/attachment.html>


More information about the swift-evolution mailing list