7 ms·
OCaml 4.03.0 released (including flambda)
- isido 11y agoDoes 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 11y agoThe 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.
- pauldirac137 11y agoIf 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.
- clw8 11y agoOh shit. I came here to ask if this was the release with multicore. Have you tested it for real-world performance enhancement?
- cm3 11y agoMulticore will take more time before it's stable, but it will be available via opam as another alternative OCaml toolchain until then. It's basically the result of KC's research: http://kcsrk.info/ http://kcsrk.info/
- jordwalke 11y agoNote that multicore includes two separate "features": the algebraic effects abstractions, and the multi-core runtime (domain heaps). From what I understand, OCaml's multi-core effort will include both of these as well as some improvements to garbage collection.
- sgrove 11y agoIt's hard to say which is more exciting for me, but it probably comes down to effect handlers in a production-capable (if not production-ready) language that can work across different compilation target. Lots of interesting tooling that can be built on top of that!
- krat0sprakhar 11y agoIf 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 11y agoCorrect. 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.
- sdegutis 11y agoAny time I want to look further into OCaml, it's because the purist in me wants a better language than the ones I'm already using. And it always comes down to Haskell vs OCaml for me, and Haskell always wins out because OCaml has lots of edge cases built into the language and the standard library that they justify and excuse rather than deprecating and cleaning up. Then again, Haskell also has Prelude. But it feels like OCaml has way more legacy cruft.
- Buttons840 11y agoI was prompted to try an OCaml tutorial by this HN post. I soon saw that strings and numbers each have a different print function. Is this part of the cruft you mention? Why have two print functions?
- deleted 11y ago[deleted]
- djur 11y agoWhen it comes to functions, there's ad hoc polymorphism, and there's parametric polymorphism. Parametric polymorphism is when you can define a function without knowing the precise type of its parameters. However, this limits what you can actually do with the parameters. For instance, a function concat([a], [a]) -> [a] which takes two lists containing items of type "a" knows enough about the type of its parameters (they're lists) to do its job, but it doesn't know everything about them. This is the type of polymorphism OCaml supports. Think of it as "one implementation, many types". That's why OCaml has more than one print function, and why it has integer and floating point versions of operators like + and *. Ad hoc polymorphism is when you can define implementations for a single function for whatever types you like. So you can implement add(Int, Int) -> Int, as well as add(Float, Float) -> Float. So this is "many implementations, many types." Haskell supports a version of this through typeclasses. OCaml doesn't currently support it, but the new "modular implicits" feature, as I understand it, will provide largely the same functionality.
- harrisi 11y ago
- krat0sprakhar 11y agoOCaml 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 11y agoIf 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 11y agoTo 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.
- xvilka 11y agoI 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
- tempodox 11y agoString & 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 11y agoThis is probably a false positive with merlin, that should not affect your code itself.
- tempodox 10y agoYou're right. It's only merlin messages in vim. Compiler itself is fine.
- pauldirac137 11y agoCan you be more specific? Show us the code that isn't working.
- nnq 11y agoDon'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 11y agoOn 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 11y agoI 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 11y agoI was thinking about how both those features use row-polymorphism.
- willtim 11y ago