Hacker News new | past | comments | ask | show | jobs | submit login

It is weird to hear someone say that ML is a language only you can program in. In my opinion, ML is the most readable code out there. I used to teach ML and it was much easier to grade by reading code than to run automated tests.



I believe the intended meaning was "a language that nobody else knows" rather than "a language where code is impenetrable to everyone but the author." OCaml is pretty easy, but not if you don't know it.


Programmers really ought to be fluent in half a dozen programming languages (that's using a wide definition which includes things like Makefiles and shell). OCaml is not exactly the most difficult one. Compared to things like J or FORTH, OCaml is pretty simple.

Also virt-builder is very procedural: https://github.com/libguestfs/libguestfs/blob/master/builder... It's "do this, then run this, and if this condition is true do something else". OCaml's strengths here are its brevity, speed and safety. No complicated features are used, eg. no functors, no difficult use of functions as first-class objects ...

(I'm not actually a fan of functors; I think they obscure the flow of the code, in the same way as using inheritance in OO).


> I'm not actually a fan of functors; I think they obscure the flow of the code, in the same way as using inheritance in OO

While functors aren't something to us every day, aren't they more of an equivalent to the Decorator pattern in OO (which is more about composition and inheritance of interfaces as opposed to inheritance of concrete implementations which I agree is something to avoid)?

That said, I think I see what you mean -- I've found myself using functors needlessly because I've previously used adapters in their place in Java; instead, it may have been for it for me to ask myself what the real problem I'm trying to solve is.


The code looks like a shell script turned into OCaml. I'm curious whether you tried some libraries that attempt to provide a shell-like interface (cash, shcaml) before deciding to just write it using the stdlib.


That could be because it was a shell script originally :-)

We're somewhat limited in terms of dependencies. We can add a dependency, but it needs to be available on all platforms we support (Fedora, Debian, Arch, SuSE, Gentoo, OS X would be the main ones). Of course this is an argument against OCaml, but so far we've been fine needing only a handful of libraries and liberally calling out to C.


>Compared to things like J or FORTH, OCaml is pretty simple.

Huh? FORTH is one of the most simple programming languages around.


I wrote JONESFORTH - a literate FORTH interpreter - and I really don't think it's easy. It's easy for me now .. having written a FORTH .. but I don't think that counts as easy for beginners.


It think it would be more accurate to say that Forth itself is simple in design, but it requires more learning to be effective than many languages.




Registration is open for Startup School 2019. Classes start July 22nd.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: