Generic Typealiases are a thing

on Mon Mar 07 2016, Chris Lattner <> wrote:

Hi All,

I just landed an implementation of generic typealiases, e.g. things like:

typealias StringDictionary<T> = Dictionary<String, T>
typealias IntFunction<T> = (T) -> Int
typealias MatchingTriple<T> = (T, T, T)
typealias BackwardTriple<T1,T2,T3> = (T3, T2, T1)

etc now work.

I have tested various scenarios with them, but I wouldn’t be surprised if there are corner cases that aren’t working yet.  Please try kicking them around and let me know if you run into any problems, thanks!

“I am become generic, the typealias of worlds” — C. Lattner


  • Can we get the Swift team moved over to the Xcode team? Or maybe open-source Xcode in order to remove the zillions of bugs and misfeatures and annoyances that Xcode has? Having a language in permanent Beta is one thing, but when your main IDE crashes all the time, the Simulators crash, and Interface Builder remains a joke, then it’s time to look at some priorities.

    I often wonder: does Apple actually use Xcode (and in particular IB) to write their own apps? It seems unbelievable that they do.

    • I always wonder what it is that makes all these things you mention be such a pain for some people, because I rarely experience any of them. I don’t remember a time when Xcode has “crashed”. I’ve never seen a simulator “crash”. IB is not perfect, it could do a lot more and do it better, but I wouldn’t call it a “joke”. Is it dev machine resources that cause the crashes? Is it simply a large code base that creates stress on the tool? I know the larger your code base, the longer builds take, but I serious would like to know what use cases are causing crashes in Xcode and the Simulator.

      • You’ve never experienced a crash in Xcode? Or Simulator? Really? That’s… astonishing. One only needs to look at radar or the official forum to see a huge and ongoing litany of crashes, bugs, misfeatures and workarounds in Xcode. And, instructively, the relative lack of communication regarding fixes…

        Try googling +”iOS Simulator” +crash -logs. Note the vast number of hits, across the timeline since introduction. And note all the suggested causes, workarounds and ensuing frustration.

        It’s great for you that you haven’t had a problem with Xcode or the Simulator. More power to you. I’ve had a completely different experience over many years, iOS and Mac, different machines. Admittedly, my code bases are large and my projects are complex, but that’s the nature of modern development.

      • Consider yourself lucky 🙂 This is in a laptop a bit over 4 months old:

        $ ls ~/Library/Logs/DiagnosticReports | cut -d_ -f1 | sort | uniq -c | sort -rn | head -4
        62 SourceKitService
        27 swift
        7 Xcode

    • David, regarding your first comment.

      The funny thing is, Apple employees work with the latest os and Xcode builds daily. They live on the frustrating bleeding edge of always-new-bugs development. I expect they find the stable outside world a delight.

  • I badly needed this for my thesis project I’m working on.
    Thank you for working on this!