I don't get the hype about Swift. There are at least 4 features in Swift I can think of that are just plain clunky:
1. Backslashed opening parens for string templating
2. Parameter labels and the use of _ when ignored
3. Splitting method names across opening parens eg. `move (to ....`
4. Verbose NSString Objective-C hangover in regular expressions
Those are really minor syntax details (except maybe the regex stuff, that’s more a library issue than a language one).
Swift is safe (no null pointer exception), has predictable garbage collection performance through ARC, has a familiar C-style syntax (easier to get on-board), has compile-time type checking, good-enough generic programming support, algebraic data types with pattern matching, and will very soon get actor support.
Plus, it has the potential to become a good cross-platform language since it’s using llvm, all it needs is a bit more love on tooling and libraries.
I don’t see many other languages with those characteristics..
Swift just seemed like yet another OCaml-like language to me; there are certainly far worse languages to borrow from, but I don't see any compelling reason why I'd use it over OCaml. ARC has the same worst cases as mark/sweep GC AIUI; exiting any scope might cause an arbitrarily large amount of cleanup work in the general case, and it doesn't solve the memory fragmentation problem which is the main reason you still need to occasionally stop the world (ish) in a mark/sweep GC.
I agree from a technical POV, but there is a social reason (network effect): Swift has Apple-backing, OCaml is not currently supported by any of the big,
influential software companies. OCaml's main backer now is Jane Street
who do a lot, but is too small, and Facebook's support (via ReasonML)
is too half-hearted to be compelling. As a former OCaml programmer, I
would not currently bank a career or startup on OCaml. Indeed I've
been doing OCaml programming over the last few weeks (and seen the shortcomings of OCaml's current library eco-system vis-a-vis more mainstream languages) in order to
interface with a big existing OCaml development, and they told me they
decided to move to Rust for all future new developments.
I say this with a heavy heart, as somebody who spent his first decade
as a programmer with OCaml.
Interestingly, even in Feb 2021, there is no compelling mainstream alternative to OCaml (in the sense that e.g. Jane Street are using OCaml):
Haskell's being lazy, Java/Scala etc as well as F#/C# being JIT'ed
make performance predictability difficult. Rust does not have this
problem, but for many tasks where software engineering agility is a more
important consideration that extreme performance (which might be most in-house business software?), a GC'ed language
would appear to be more suitable.
Thanks. I was not aware of this, since I've not worked on a Microsoft stack for a long time. Are those F# AOT compilers mature and support all features, including libraries? In this case F# would be a viable alternative to OCaml for Jane-Street-like tasks.