Well, the problem with C++/Java and the ML language families is that they are quite incompatible, so it's not really trivial to mix them. Many languages have tried, most recent languages really. Rust is C with ADTs or ML without garbage collection (not yet sure how closures will turn out), Scala is Java with first-class functions and ADTs, Java and C# are absorbing more and more features from ML, ...
Swift is just another attempt to mix the two, quite a successful one IMO. They kept some warts, probably to maintain binary compatibility with Obj-C, but otherwise I think it's a huge improvement over Java-style languages.
One particular pain point between Java-style and ML-style languages are generics; Java and C# have a common object protocol and thus allow a top type, Object, and run-time type information. So, they must decide whether generics/type parameters are only relevant at compile-time (Java) or are kept at run-time (C#). ML avoids this issue by not having any runtime type information (and no type-testing construct). I haven't yet found where Swift stands, but it's a hard problem to solve.
Swift doesn't have a designated base class like Java, C#, or Objective-C's NSObject. It seems, though, that there are a bunch of interop considerations which means that you might need your Swift classes to inherit from NSObject for them to work properly with Cocoa code.
Swift also doesn't perform type erasure. You can do something like the following, as I believe is possible in C#:
struct SquareMatrix<T> {
let dimension: Int
var backingArray: Array<T>
init(dimension d: Int, initialValue: T) {
dimension = d
backingArray = T[](count:d*d, repeatedValue:initialValue)
}
subscript(row: Int, col: Int) -> T {
get {
return backingArray[row*dimension + col]
}
set {
backingArray[row*dimension + col] = newValue
}
}
}
Swift is just another attempt to mix the two, quite a successful one IMO. They kept some warts, probably to maintain binary compatibility with Obj-C, but otherwise I think it's a huge improvement over Java-style languages.
One particular pain point between Java-style and ML-style languages are generics; Java and C# have a common object protocol and thus allow a top type, Object, and run-time type information. So, they must decide whether generics/type parameters are only relevant at compile-time (Java) or are kept at run-time (C#). ML avoids this issue by not having any runtime type information (and no type-testing construct). I haven't yet found where Swift stands, but it's a hard problem to solve.