News for hackers. Stuff that matters.
Re:OCaml 5.0 Alpha Release by _flux on Wednesday June 15, 2022 @07:03AM (#31751300)
OCaml is possibly my favorite language, along with Rust, and what I hope from the Santa is projects like https://github.com/tezedge/ocaml-interop to become mature.

I think all these "properly typed" languages should aspire to have great interoperability: after all, they have types to help. But I realize there can be big technical difficulties in making it safe, in particular with garbage collection..

Re:OCaml 5.0 Alpha Release by anentropic on Wednesday June 15, 2022 @08:29AM (#31751967)
I'm a bit confused...

the readme of ocaml-interop says it's "inspired by" ocaml-rs

while ocaml-rs says it "uses ocaml-interop behind the scenes" and "also exports an interop module, which is an alias for ocaml_interop and the two interfaces can be combined if desired"

from a cursory look over ocaml-rs seems possibly the one to use, as the more comprehensive project

Re:OCaml 5.0 Alpha Release by gadmm on Wednesday June 15, 2022 @09:30AM (#31752598)
The development of the OCaml-Rust interface is a bit organic. `ocaml-interop` aims to be a low-level but safe interface. At Inria we worked with the author to integrate ideas about using Rust's type system to safely work with a GC. We have more ideas to make it better; if someone wants to commit engineering time in this area they should feel encouraged to contact me.
Re:OCaml 5.0 Alpha Release by CodeSgt on Wednesday June 15, 2022 @08:01AM (#31751706)
How does it compare to Rust? What do you like about each?
Re:OCaml 5.0 Alpha Release by ChadNauseam on Wednesday June 15, 2022 @08:30AM (#31751978)
The garbage collector is nice because sometimes you don't want to think about memory management or the borrow checker.

The syntax is really cool, it looks like python but it's completely whitespace insensitive.

The module system is neat, and I actually like writing module interfaces (which are basically analogous to header files in C/C++). It makes dependency injection trivial, because you can have a module say "I depend on a module with this interface, but the caller can choose which one", which is more useful than it sounds.

It's also a functional language, so you have very little mutability, and it supports """monads""" with its super innovative "monadic let" syntax. (It's basically like overloading the semicolon, which probably doesn't make any sense, but it's really cool.)

Dune is a very pleasant build system and Esy is a very pleasant package manager. The language server is good. I'd say in this dimension it's competitive with Rust.

There's really quite a lot to like about OCaml. My biggest gripe with it is no typeclasses/traits. But I have hope that modular implicits will land within our lifetimes.

Re:OCaml 5.0 Alpha Release by tgflynn on Wednesday June 15, 2022 @09:41AM (#31752742)
What exactly is Esy ? I hadn't heard of it before and its website doesn't seem to provide an obvious answer to that question.

You say it is a package manager. Is it supposed to replace opam ? If so what does it offer that opam doesn't ?

Re:OCaml 5.0 Alpha Release by ChadNauseam on Wednesday June 15, 2022 @02:16PM (#31756999)
It's a package manager that replaces Opam. It doesn't require switches and it caches builds of packages across projects.
Re:OCaml 5.0 Alpha Release by pdimitar on Wednesday June 15, 2022 @12:56PM (#31755832)
It's like Rust's cargo or Elixir's mix. A task runner, mostly.
Re:OCaml 5.0 Alpha Release by UncleOxidant on Wednesday June 15, 2022 @11:26AM (#31754422)
> The syntax is really cool, it looks like python

I'm squinting really hard but not seeing the resemblance.

Re:OCaml 5.0 Alpha Release by ChadNauseam on Wednesday June 15, 2022 @02:17PM (#31757022)
I said that because there's no curly braces and you don't usually have to use semicolons
Re:OCaml 5.0 Alpha Release by throwamon on Wednesday June 15, 2022 @02:54PM (#31757611)
> you don't usually have to use semicolons

That's compensated by the use of double semicolons :O)

Re:OCaml 5.0 Alpha Release by ChadNauseam on Wednesday June 15, 2022 @03:22PM (#31758054)
Ha! That's only in the REPL, which I never use