Remix.run Logo
mpalmer 4 hours ago

Have yet to find a better choice than OCaml:

- Strongly typed, including GADTs and various flavors of polymorphism, but not as inscrutable as Haskell

- (Mostly) pure functions, but multiple imperative/OO escape hatches

- The base language is surprisingly simple

- Very fast to build/test (the bytecode target, at least)

- Can target WASM/JS

- All code in a file is always evaluated in order, which means it has to be defined in order. Circular dependencies between functions or types have to be explicitly called out, or build fails.

I should add, it's also very fun to work with as a human! Finding refactors with pure code that's this readable is a real joy.

CuriouslyC 9 minutes ago | parent | next [-]

Seems like if you're in that boat you'd just want to go with F# though?

strongly-typed 44 minutes ago | parent | prev | next [-]

Strong agree. OCaml's compiler is sofa king good at catching and preventing real bugs that the agents accidentally introduce here and there. It's the same as with humans, except the agents don't complain about the bullshit reasons humans don't like OCaml. They just crank through and produce high quality output.

daxfohl 3 hours ago | parent | prev | next [-]

How's the multicore and async story these days? I remember that was one of the big draws of F# originally, that it had all (or, most of) the type safety features of OCaml but all the mutlicore of dotnet. (Plus it created async before even C# had it). Has OCaml caught up?

sweetsocks21 3 hours ago | parent [-]

OCaml has full multicore support with algebraic effects now. The effect system makes things like async very nice as there's no function "coloring" problem: https://discuss.ocaml.org/t/ocaml-5-0-0-is-out/10974

But I don't believe the effects are tracked in the type system yet, but that's on it way.

lambda_foo 2 hours ago | parent [-]

The type system for effects is an ongoing research effort. For now you get unhandled effect exceptions at runtime.

With Multicore OCaml we gained thread sanitizer support and a reasonable memory model. Combined they give you tools for reasoning about data races and finding them. https://ocaml.org/manual/5.3/tsan.html

lambda_foo 2 hours ago | parent | prev [-]

Strongly agree, plus OCaml has an expressive type system that lets you build abstractions that just aren’t possible with Go. The original article gives poor reasons for choosing Go.