I like OCaml, I spend most of my day to day though in Elixir and I think one of the things that's so nice about elixir is mix.
There's a handful of mix commands you learn when you get started and it's such a great experience. You can crack open erlang application structure and learn more if you want, but if you just want to `mix compile` `mix deps.get` `mix test` that's also fine.
When I first learned ocaml I watched this really wonderful series https://www.youtube.com/watch?v=MUcka_SvhLw&list=PLre5AT9JnK... (highly recommend if you are at all interested) and it's great for learning the language and tooling but it's all opam up until the end when some of it switches to dune.
I think wanting to provide more details about what's going on is nice too, but I think there's a place for "here's the commands you will actually need in your day to day"
what is wrong with make why does every language need to re invent packaging, building, etc. I think these people have no useful software to write so they rewrite the development stack.
When I started learning make it wouldn't work and I wouldn't understand why so
I dug into it and now I understand how it works and I can make it work but seasonned programmers still tell me my makefiles are wrong and then proceed to use even more arcade parts that render their makefiles incomprehensible.
At some point I just gave up makefiles for anything non-trivial and went over to xmake where life is mostly simple and I never do it wrong.
I tried to write some Ocaml stuff using a Makefile, because I also didn't want to use even more specific tooling, but it became ugly quickly, because I had to use `ocamlfind` and `ocamlc`, and provide a list of all packages to include and so on. It felt a bit like writing C at that moment, where you need to tell gcc what system libraries you are using, so that it compiles the program with those.
So in the end I tried using dune and opam and whatnot, but it all felt less than clear to me. Especially, the comment someone else made here about having 2 different types of files for dune to work ...
I just want a project local directory, that contains all my dependencies and a lock file to reproducibly built my projects. That's the minimum I expect these days. Or some equivalent alternative.
I use Dune only for my local libraries, because the install step fits perfectly. But my app projects all use a Makefile, including apps with a table-driven parser (Menhir), where the OCaml `.ml` source has to be generated first. You have to know `make` well enough to do that, but it's definitely possible.
what’s wrong with make is largely that people are bad at writing makefiles. A tool like dune is able to enable cross compilation of a massive number of libraries out of the box, but make based projects that weren’t designed with it in mind almost always require someone to go through and separate out the mess of what needs to run on the host vs be built for the target, etc, etc
This is a good introduction to Dune, but frankly, Dune kinda sucks. I mean, it is very powerful, and works very well, but it's too much of a hassle, especially for beginners. I don't want a language specific build system to require two different files to actually be usable, even on very simple projects… I still use it because it is the de facto standard, but I really preferred ocamlbuild [1], which was actually a tool that just worked without any configuration necessary for simple projects that uses standard tools. Where you would need to write a Makefile and call make, you could just write nothing and call ocamlbuild and it would just work. Dune lost that ability entirely.
Does anyone know what's up with ocaml on windows? I haven't used it in a while. Trying to install utop on 5.x compiler and quite a few packages need a downgrade to 4.x? I've tried with both mingw and system-msvc. Same behavior.
I have been trying to read the original Dune "documentation", but it never told me how to do the stuff I needed to do. Finding pertinent information was based on pure luck, and even then it was tough as old chewing gum to find out "how do I do X?". The target audience is apparently limited to wizards who already perfectly understand Dune.
Maybe this introduction will finally do the trick.
15 comments
[ 3.3 ms ] story [ 42.7 ms ] threadThere's a handful of mix commands you learn when you get started and it's such a great experience. You can crack open erlang application structure and learn more if you want, but if you just want to `mix compile` `mix deps.get` `mix test` that's also fine.
When I first learned ocaml I watched this really wonderful series https://www.youtube.com/watch?v=MUcka_SvhLw&list=PLre5AT9JnK... (highly recommend if you are at all interested) and it's great for learning the language and tooling but it's all opam up until the end when some of it switches to dune.
I think wanting to provide more details about what's going on is nice too, but I think there's a place for "here's the commands you will actually need in your day to day"
So in the end I tried using dune and opam and whatnot, but it all felt less than clear to me. Especially, the comment someone else made here about having 2 different types of files for dune to work ...
I just want a project local directory, that contains all my dependencies and a lock file to reproducibly built my projects. That's the minimum I expect these days. Or some equivalent alternative.
[1] https://github.com/ocaml/ocamlbuild/blob/master/manual/manua...
https://github.com/dharmatech/ocaml
Maybe this introduction will finally do the trick.