Hacker News new | ask | show | jobs
by jonloldrup 2908 days ago
I'm wondering whether Ceylon could be considered a modern day Ocaml substitute? It has a very strong type system, focus on immutability, a strong module system and Object Oriented capability. What's missing?
3 comments

Ocaml is a perfectly good modern day language. Our entire codebase at work is built on it and we’re pretty satisfied.
I don't think Jane Street would be using OCaml to this extent if it needed a "modern day substitute". And the language is evolving, which is always a healthy sign.
Okay, wrong wording. However, Ocaml has several 'warts'. https://news.ycombinator.com/item?id=9583659

I suggested Ceylon as the 'modern day substitute' in the sense that it has had the opportunity to learn from mistakes made by the older FP languages. Ceylon has a very consistent type system and is therefore able to deliver more clear error messages.

Since that user didn't specify them, what would you view as these warts?
It has 3 (4?) different, not very compatible stdlibs, for example. Also 3 tools for syntactic extension, two of which suck incredibly, while the last one is pretty new. It has 2 (3 if you count Reason) very different syntaxes defined, even though I've never seen the "light" kind in the wild. The whole String mutability story is interesting in its own right. I'm sure there's a lot more.

But note: every single language has warts like this, especially if it's been developed for a couple of years already. I think OCaml has probably fewer warts than JavaScript, or PHP, or even Java; but more than Go, or Elixir, or Scheme. It's still very nice language and toolchain, though, perfectly usable in many cases - the learning curve may be steep at some points, but on average it's not that hard to learn, and you gain a lot of benefits if you do.

OCaml isn't without its warts (like any language), but I don't quite think you've nailed them.

For one, the different stdlibs are in fact highly compatible. Basic types (option, result, string, int, array, float) are all the same, so code using different stdlibs works together seamlessly most of the time.

Lwt and Async are a different story, and there is a real incompatibility problem there.

The syntax extension story is pretty clear and simple: PPX rules the roost, and the tools for building PPXs are quickly getting better and more unified. Reason is an interesting variant in the ecosystem, but its existence doesn't amount to a wart in my eyes. It's an alternative syntax that you can use interoperably with the rest of the OCaml ecosystem (and Dune makes that awfully easy.)

Some clarifications:

It has one standard library, and several alternative standard libraries of varying popularity. I would argue that Core is probably the most popular. For what it's worth, Haskell also has several replacement for its standard library, Prelude.

For the syntax extensions, the community has largely migrated to PPX. Alternatives are being phased out.

String is no longer mutable in recent versions of OCaml. The string type is now immutable, and a new type, bytes, has been introduced which is mutable.

I don't think Ceylon is really in the same category as OCaml. OCaml is closer to F# and Haskell. Ceylon is probably closer to Kotlin.
I agree with the rest of your comment, but I think this Ceylon is probably closer to Kotlin. is unfair on Ceylon

Kotlin basically has the Java type system with a few extensions, but no substational changes.

Ceylon has its own type system that draws heavily from the FP/ADT style of thinking. It's not OCaml (nor does it want to be), but it's also not Kotlin.

Where does it fall relative to Scala?