News for hackers. Stuff that matters.
Re:A Video Walkthrough of Swift Fundamentals by austinz on Friday January 23, 2015 @08:36PM (#8938465)
Swift's Optional is just Maybe with some built-in sugar. Sum types are supported, with the caveat that the compiler is sort of broken when it comes to generics.

Personally, I just want higher-kinded types, and for the following code snippets to work as-is:

  enum Either<A,B> {
    case Left(A)
    case Right(B)
  }

  enum Tree<A> {
    case Leaf
    case Node(Tree<A>, A, Tree<A>)
  }
The first breaks because of the "Unimplemented non-fixed multi-payload enum layout" compiler error, and the second breaks because enums have value semantics. Both can be worked around in full generality by declaring a 'Box<T>' generic wrapper class, but that workaround is inelegant and cumbersome.

There are no comments on this comment yet.