4 ms·
IMHO the biggest factors when evaluating a new programming language boils down to "modules" i.e the methods for creating reusuable units of code, and "package
by jfaucett 11y ago
IMHO the biggest factors when evaluating a new programming language boils down to "modules" i.e the methods for creating reusuable units of code, and "package management" i.e. how easy is it require previously built units of code and combine them to create compound units. I wish he had talked more about those aspects.
For me, any language that misses these two is not worth the effort unless you have really good reasons (i.e. every clock cycle counts in an embedded program).
Anyway, to that end, what is OCaml's packaging ecosystem like?
- yminsky 11y agoThese days, it's pretty good. opam is the tool of choice: http://opam.ocaml.org http://opam.ocaml.org I've found it to be surprisingly reliable and easy to use.
- mbrock 11y agoI'm not very familiar with the actual library distribution stuff in OCaml, but linguistically, the ML style of modules and interfaces is really nice, and sometimes even Haskell programmers envy it. Especially the built-in distinction between an interface and an implementation, which lets you depend on an abstract API rather than on a concrete library.
- a0 11y agoIm my experience OCaml has the best modularity abstractions out there. OCaml modules are unique since they allow you to work with blocks of code (and types) on a higher level. Composing and extending modules, passing modules as parameters to other modules and this way adapting the code to your need. And the nice thing is that all the modules are evaluated at compile-time. Which means you don't have to sacrifice performance for modularity and still get a very flexible framework for Metaprogramming[1]. [1]: https://ocaml.org/learn/tutorials/modules.html#Functors https://ocaml.org/learn/tutorials/modules.html#Functors
- tel 11y agoIt sounds like you're already aware of this from your question and others have already beat me to the punch, but: OCaml modules are best of breed. Better than anything else. Nothing else even comes close. They're weird and different from modules you'll see in other languages. Then after you get used to them you'll find those other modules are at best neutered and most likely severely broken versions of what you've come to know and love from OCaml (or any of the true MLs). OCaml modules arise from a certain treatment of "existential types" which are, in a lot of ways, the very foundation of type abstraction. If you don't care about types practically, then you can care about them spiritually as a means of describing program interfaces. Existential types are maybe the very foundation of abstract program interfaces. So, OCaml is at least 50% good. Opam is kind of nice, too.