
OCaml 4.03.0 released (including flambda) - cm3
https://sympa.inria.fr/sympa/arc/caml-list/2016-04/msg00075.html
======
pauldirac137
If you've been away from Ocaml for a while, this would be a great time to
check out what's changed. A package manager, a new optimizer, and we'll soon
have modular implicits (think Haskell-style type classes, but better) and
multicore. Ocaml is really a first-rate programming language and I wish more
people knew about it.

~~~
krat0sprakhar
If I'm not mistaken, this release is not the multicore release[0]. Also, if
anyone's keen on reading the paper behind modular implicits in OCaml, its a
fun read - [http://arxiv.org/abs/1512.01895](http://arxiv.org/abs/1512.01895)

[0] -
[https://blogs.janestreet.com/flambda/#comment-39958](https://blogs.janestreet.com/flambda/#comment-39958)

~~~
pauldirac137
Correct. Multicore _may_ come in 4.04 if we're lucky. No ETA for modular
implicits AFAICT, but I really want them ASAP; they will be a game-changer.

------
krat0sprakhar
OCaml is a great language. I'm so glad I was forced to learn at in university.
Apart from the language itself, the ecosystem surrounding it is very mature as
well.

\- OCamlbuild is the bee's knees. Configuring complex projects requires just
one line in the Makefile

\- OPAM works wonderfully. No configuration required. Everything just works.

\- Merlin ([https://github.com/the-lambda-
church/merlin](https://github.com/the-lambda-church/merlin)) is incredible. If
you use Vim / Emacs, you owe it to yourself to set it up and have better
syntax highlighting, indentation and type information right within your
editor.

\- Approachable online guides to get started. RWO[1] is a fantastic resource
and teaches you the good parts right from the start.

\- Utop ([https://github.com/diml/utop](https://github.com/diml/utop)) is a
very modern, fully-featured REPL (almost as good as IPython)

\----------

If you've been thinking of learning OCaml, here are a few useful resources -

\- Real World OCaml [RWO] -
[https://realworldocaml.org/](https://realworldocaml.org/)

\- Using, Understanding, and Unraveling the OCaml Language -
[http://caml.inria.fr/pub/docs/u3-ocaml/index.html](http://caml.inria.fr/pub/docs/u3-ocaml/index.html)

\- Developing applications with OCaml -
[http://caml.inria.fr/pub/docs/oreilly-
book/html/index.html](http://caml.inria.fr/pub/docs/oreilly-
book/html/index.html)

\- System programming in OCaml -
[https://ocaml.github.io/ocamlunix/ocamlunix.html](https://ocaml.github.io/ocamlunix/ocamlunix.html)

Lastly, if you are out of ideas on what to build with OCaml, try out these
courses for some challenging programming assignments

\- Functional Programming (Princeton) :
[http://www.cs.princeton.edu/~dpw/courses/cos326-12/info.php](http://www.cs.princeton.edu/~dpw/courses/cos326-12/info.php)

\- Programming Languages and Compilers (UIUC):
[https://courses.engr.illinois.edu/cs421/fa2014/](https://courses.engr.illinois.edu/cs421/fa2014/)

~~~
cm3
If you use Core, after reading RWO, and don't like the large executables, rest
assured that there is an effort by one of the flambda devs to improve dead
code elimination as well, but that will also take a while before it's
available. I wish it would happen soon, now that flambda has landed.

~~~
jonathanyc
To provide an alternate viewpoint, OPAM isn't that great of a package manager
if you've come from other languages or have used a Linux distro's package
manager. It's incredibly slow, partly because you're supposed to use an
external constraint solver. When it crashes, it leaves lots of things in an
inconsistent state. It's environment handling is really picky and gives
warnings about not being set up properly even when it is, because it used to
(maybe still does) expect itself to be the last thing in a lot of environment
variables. It is something I try to avoid when possible.

EDIT: Sorry, realized I replied to the wrong comment. Meant to reply to the
grandparent.

~~~
e_d_g_a_r
When it crashes it literally gives you the command to undo the damage. How
many package managers do that?

~~~
adrusi
Better to not cause the damage in the first place, consolidate the parts of
the transaction that were usefully completed into an isolated location, and
provide a way to resolve the issue and resume the transaction. I think at
least Pacman and Yum do this.

~~~
jallmann
Calling failed builds "damage" is rather overstating it. If building a
specific package fails, OPAM continues with as many other packages as it can.
Arguably that's not even "transactional" in the atomic sense, but the behavior
is pretty much what you said.

Then it gives you the error, and gives you a command to roll back everything
to the previous state -- something I cannot do with eg, apt, as far as I know.
But that's a bit apples and oranges -- apt, yum, pacman, etc are all binary
package managers, with a different set of tradeoffs.

------
xvilka
I hope after this release they will start improving OCaml support for Windows
too (mostly smoothless opam experience, like the package managers for other
languages)
[https://github.com/ocaml/opam/issues/2191](https://github.com/ocaml/opam/issues/2191)

------
isido
Does anyone know the logic behind the version numbering? 4.0x's seem to have
pretty major changes between them. And what's the leading zero?

~~~
LeonidasXIV
The first part is major changes, like the addition of GADTs in 3.12 -> 4.00.

The second number is also kinda major features, but not as large. Kinda
similar to the Python release cycle. New features get introduced here, so
things like multicore, flambda, effects, modular implicits would land here. It
has a rather long release cycle but I heard there are plans to shorten the
release cycle to something like roughly 6 months. These are 2 digits zero-
padded for no real reason except maybe easier string sorting, so 4.03 would
translate to 4.3 and 3.10 would be 3.10 and not 3.1.

Then the last digit is for patches and regression fixes that do not introduce
new features.

------
tempodox
String & array indexing seems to be broken (Error: Unbound value .[]) in
'4.03.0+trunk+flambda'. Am I too early for a regular release of 4.03?

~~~
octachron
This is probably a false positive with merlin, that should not affect your
code itself.

~~~
tempodox
You're right. It's only merlin messages in vim. Compiler itself is fine.

------
nnq
Don't want to start a flamewar but... why choose OCaml over Haskell nowadays?

Want purity, elegance and best community resources? Go with Haskell. Want
Functional+OOP+kitchensink? Go with Scala. Want .NET? Go with F#. Want a
strict/eager Haskell? Apply for a job at Standard Chartered (they say they
have an in-house strict and better optimizing Haskell compiler).

What would X be, so that you would be able to say "Want X? Go with OCaml"?

~~~
ufo
On a practical level, I'm very fond of the strict evaluation and the lack of
purity. Its easier to write "traditional" imperative algorithms when you don't
need to use monads or monad transformers everywhere.

When it comes to resources, I don't think Haskell is strictly superior. opam,
merlin, and utop are pretty nice... I'm also very fond of the menhir parser
generator.

On a theoretical level, Ocaml does have some neat things missing from Haskell,
like its module system (with functors), polymorphic variants, etc...

\---

BTW, I wouldn't dump Ocaml in the "object oriented" side of things together
with Scala. Nowadays the OO infrastructure is more commonly used for
polymorphic variants than for OO, to be honest.

~~~
pauldirac137
I would hesitate to call polymorphic variants "part of the OO infrastructure".
They are really orthogonal to OO, but they do make OO less necessary.
Ironically, OCaml has a really nice OO system but it's rarely used because
with modules and functors there is little need for it. Put differently, a lot
of the conventional use for OO is as a poor man's module system, and when you
have a really good module system, you only use OO when you absolutely need the
OO kind of polymorphism, and those cases are surprisingly rare (like
existential types in Haskell).

~~~
ufo
I was thinking about how both those features use row-polymorphism.

