Expanding ocaml appeal to future open source application developers

Yes, a lot of people seem to have this grouse against OCaml that dune, opam, utop, odoc etc. should be a single tool and the current situation is intolerably fragmented. It indeed has become a popular trope.

To be honest I kinda like it this way. I like picking and choosing my tools and a lack of totally monolithic “blessed” OCaml specific “mega-tool” allows innovation. The “unix philosophy” is to do one thing and do it well. I don’t think the philosophy yields the optimal system in every scenario but it works well in practice. Linux for instance has a plethora of tools coming from different creators and they are brought together by system integrators like Debian, Red Hat, etc. The important thing is if the whole system is reasonably consistent and works well. So as far as I’m concerned let there be many tools and let them work well together. At this point the dune+opam+ocaml-lsp-server+utop+odoc “suite” of tools are mature, featureful and reasonably well documented.

What about cargo you might add? Yes, cargo is cool and Rust was lucky to have had visionaries who have produced such a nice integrated tool. But OCaml has a secret weapon: gc :slight_smile: . Rust can be quite tough to program in (I have done a good amount of Rust). The time I’ve probably saved using cargo has been expended many times over thinking about memory in Rust :wink: . I would recommend using Rust only when you really need the low-level performance. OCaml is definitely more “general purpose”. But I digress…

I think the solution to increase OCaml uptake is simple – make good software. A few more anchor OCaml projects that are ground breaking and innovative will attract more developers. Haskell is a difficult language to learn but yet seems more popular. Why? Haskell programmers have built some innovative software projects that are ground breaking. I see that there are definitely some cool OCaml project around. If some of more these projects hit the popular imagination, I feel OCaml will definitely attract more people. And they will be willing to deal with the non-integrated tooling story as long as the language will help them produce some cool software.

7 Likes

This is well and good but there is clearly a desire for an integrated tool in the OCaml world too, because two different projects are working on it: esy/pesy and drom.

The problem with the Unix philosophy is that it adds another layer of complexity to deal with when you’re new and just trying to get started with the language. From the perspective of an experienced OCamler it’s great because as you say you can pick and choose, but by the same token, newcomers suffer from the ‘tyranny of choice’.

The important thing is if the whole system is reasonably consistent and works well.

Right now we have two places to put project metadata: opam files and dune-project files. The latter mostly supports the fields supported by the former, with exceptions where we have to use a template file to inject the unsupported ones. It works but the whole thing is rather clunky. Pretty regularly people come here and ask about this kind of issue.

The time I’ve probably saved using cargo has been expended many times over thinking about memory in Rust :wink:

These are two separate issues, we are not asking to add the language complexity of Rust to OCaml, only the simplicity of its build tool, cargo.

I think the solution to increase OCaml uptake is simple – make good software.

Everyone wants to make good software, I wonder why they don’t just do it :wink:

Seriously though, I touched on this in another thread, but imho the biggest impact on OCaml adoption would be a dead-simple Windows install and dev experience. As much as everyone loves to ‘critique’ it, I think this is one thing (among several) that Node.js absolutely nailed. You run the installer and get the node and npm executables in your path, and everything just works even from a Windows command prompt.

4 Likes

Watching discussion in this thread I got a feeling that we need to write something like Main Linux problems on the desktop, 2021 edition or why Linux sucks and update regularly to track a progress.

2 Likes

It’s worth remembering that we’re chasing a moving target. While the OCaml experience has improved a lot in the last couple of years, other languages with no baggage have popped up, and old competitors have improved their experiences, too, and they were ahead to begin with. There’s no objective measure here – it’s all about the competitive advantage and experience relative to other languages vying for programmers.

In general I would like to say that the points @yawaramin (and others have made in a similar vein) are logical and reasonable.

But I personally don’t tend to place so much emphasis on the tooling story.

I’ve just written a blog titled “General thoughts on Ocaml & Haskell and OCaml’s (supposedly) pathetic state of tooling”. I wrote this partly in response to some of the views expressed on this thread and similar discussions that have taken place in the past.

It also summarizes some of my other views about Ocaml in general and the elephant in the room: OCaml vs Haskell. Check it out!

I’ve also opened up a new topic here:

1 Like

I don’t think that I really buy the argument that Ocaml tooling is rubbish, at least for unix-like platforms. opam in my view is a work of art. To install ocaml on a unix-like platform you just need a C compiler, download the latest opam binary for your platform from Releases · ocaml/opam · GitHub , do opam switch create ..., and away you go. dune takes a bit of getting used to but it is a great deal easier to use than cmake or autotools and has the benefit in my view of being pretty well documented.

Sure, some of the windows tools for C/C++ and the CLR are pretty good, and Rust happened to start from the ground floor with cargo which gives it a good story to tell. But leaving aside ocaml on the windows platform (which appears to need further work) I think ocaml’s position on tooling, for a compiled language, is pretty good.

On a different topic, as an outsider I was also impressed when I first came across js_of_ocaml. For code which fits within the js_of_ocaml/node or js_of_ocaml/browser subset of ocaml, it makes programs highly portable.

1 Like

I think documentation and “marketing” of projects are the biggest issues when it comes to attracting new developers.

I’d like to give an example. Recently I needed a websocket client library for a hobby project, and the only one I found was:

It works very well and since I know OCaml it was easy to look at the code and figure out how to use it. But a person learning OCaml would be discouraged by the absence of clear documentation, the lack of small examples in the README, by the syntax used in some places (>>= in wscat.ml which one needs to look at to start using the library etc), and by the lack of clear signs that the library will be maintained. And this lack of “inviting” documentation is common in OCaml, where some quality projects seem to be made “by OCamlers for OCamlers”.
And just to be clear, I’m very grateful to the person who wrote this library and made it available, for me it’s perfect.

Compare with a popular websockets library for Python (random result):

This kind of approach, making every effort to sell the library and help the user become productive as fast as possible, is much more attractive to new users.

Having said all that, some projects like for example Dream, Owl, and many more have amazing documentation.

5 Likes

This is very much a function of the number of contributors to the library. The problem is that as a user, one doesn’t judge a library by the amount of work done per contributor, but rather by the result.

1 Like

I have to disagree with this. I’ll take Dream as an example, due to personal experience, but this undoubtedly applies to other projects as well.

The initial extensive documentation was done when Dream had only one contributor. Of course, since then, the repo got a lot more very nice examples and other documentation from more contributors.

Conversely, aaugustin/websockets doesn’t have that many contributors — only 43, according to GitHub. I took a superficial look at the history of the docs/ directory, and the vast majority of the commits are from aaugustin.

The next claim might be inaccurate, but based on the above, I would suggest that quality of documentation or marketing is a function of the initial effort of the original authors, or a small number of initial or major later contributors. These initial contributors set the tone — that good documentation is valued, welcome, that more such documentation will be worked in, that the project cares about its users and contributors, etc.

Contributors with less time to create whole-project documentation are then naturally and reasonably more willing to work on parts of it. I claim that in OCaml, many (not all!) individual authors either do not have time to, or do not care to, set such a tone for their project. So if this is a problem, it can probably be considered a cultural problem, at least in this line of reasoning.


@dimitris As a note, Dream also supports WebSockets. You can even mess around with them in the playground :slight_smile:

12 Likes

I agree and I’d also like to point out
Daniel Bünzli’s software doc as an
example of quality libraries that have really good documentation even
though they have mostly only one author.

6 Likes

Among other things I’d like to mention this general purpose minimal introduction to unicode :grin:.

12 Likes

I’m shocked, my whole system is utf8 and I did type ü :confused: not sure what happened…

3 Likes

This guy nailed it, and IMO people is missing the point by asking him to provide concrete details. He gave a great overview of the overall problems of the ecosystem, it’s not meant to solve his particular experience.

1 Like

@antron that’s great to know, i definitely plan to use Dream.

why does it have to expand? What benefit comes from courting the masses?

Speaking for myself (as I currently have no other surveys at hand), I was appealed a bit more than a year ago exactly by OCaml being

  1. functional
  2. aged, so likely to be around in decades, still
  3. seemingly quality-aware, mature community
  4. no GAFAM in the critical path (at least I thought so not being aware of the role of github in opam)
  5. feasible on small hardware like the raspi, too (no, Haskell, you’re not)
  6. static linking
  7. nice stickers OCaml Stickers via 🐌

I hesitated, because of the syntax variants (ppx!), standard lib confusion and dune configs scaring me. Avoided complexity here and never regreted, however.

The stuff I do is trivial and opinionated stuff for now, like https://mro.name/form2xhtml or https://demo.mro.name/geohash.cgi/ until I find resources to translate :de: https://mro.name/o/2021-03-30-142424-prototypefund10-068.pdf to english, let alone finally do it in :camel: OCaml.

2 Likes

Presumably, when there are more users, there are more people able to write and publish libraries, and a growing package ecosystem makes our favourite language more feasible in many different use cases :slight_smile:

2 Likes

I’ve seen java and ruby going down the drain when the masses came and was disgusted by node. History repeating isn’t appeling to me.

3 Likes

If by ‘going down the drain’ and ‘disgusted’ you mean ‘they became wildly popular and mainstream tech’, then sure :wink: Another way to look at it: the more mainstream OCaml is, the better the chances that enthusiasts like us get to write it one day in our day job.

That’s more a problem of the day jobs as it is of OCaml. Mainstream is IMO another word for mediocracy. OCaml should (edit:) not strive for that.

2 Likes

I’ve been programming in OCaml and caml-light since 1991. I’m the sort of guy who thinks comments are for weaklings, and if I can’t figure out a piece of code I wrote 10yr ago, then that’s on me for being weak. Honestly, “sometimes the best documentation is the source code”. Etc.

But even I can see that the leaders of OCaml have every right to want OCaml to be more popular, and that it’d be a good thing for the world. I agree with Yawar, that a big obstacle is the lack of a seamless newbie experience on Windows. And I say this (again) as somebody who wouldn’t touch Windows with a ten-foot pole.

I’m glad you guys are trying to figure this out, even if it will never affect me.

3 Likes