Hacker News new | ask | show | jobs
by tacos 3929 days ago
And now's a perfect time to reflect on how the two languages evolved during the past decade. C++ obviously moved forward quite a bit -- cleaning up the loop constructs in particular.

OCaml? Uh... there's F# for realists, Scheme for optimists, and Haskell for pedants. If you're actually writing OCaml web apps in OWebl I'd sure love to know why. Amazon released a native C++ SDK for AWS if you're into pain. If you're using "OPAM" to install the OCaml AWS client... wow.

3 comments

Let's see: opam as you mention. Loads of new libraries[0]. Lots of small evolutions in the language in OCaml 4 [1] [2]. Lots of work on optimization in ocamlopt. Aarch64, POWER7 & POWER8, replacement ARMv7 backends.

OCaml is totally a practical language for writing real world applications. As I usually point out in these threads, Red Hat pay me to write OCaml programs[3], that are used by thousands of customers and many more free software users worldwide. The advantages (over other languages, not C++) are: easy linking to C libraries, and builds a native binary with no extra dependencies, speed. Advantages over C++: safety, robustness, compact source code size.

[0] https://opam.ocaml.org/packages/

[1] https://ocaml.org/meetings/ocaml/2014/OCaml2014-Leroy-slides...

[2] https://ocaml.org/meetings/ocaml/2013/slides/leroy.pdf

[3] https://github.com/libguestfs/libguestfs

Looks like solid work all around. But if we could weigh it relative to the advancements in C++ the last decade, it wouldn't even show up on the scale.

Red Hat could pay someone to do exactly what you're doing in many other languages with the exact same results. The only difference would be that the language in question would show up on the StackOverflow list of "most loved" or "most wanted" languages. Rust shows up in 50th place with less than 0.2% share and OCaml doesn't even make that list (TIOBE 9/2015).

Sounds argumentative, but is a genuine question: why have you chosen OCaml for this? What is so remarkable about it for this use case that 50+ more popular languages wouldn't do it?

Obviously there are downsides, so what is the upside?

Did you read my reply? To quote: "easy linking to C libraries, and builds a native binary with no extra dependencies, speed ... safety, robustness, compact source code size" There are certainly many more popular languages, but few with that combination of advantages. The project started in 2009, so you should discount any languages which were not mature before that date.

There are a few people at Red Hat and outside who contribute. To my knowledge none had prior experience with OCaml, but it's pretty easy to pick up.

even in 2015 i can only think of D, go and haskell that would work as viable alternatives.
You write OCaml for Red Hat programs that customers use? Or you write OCaml for Red Hat customers' programs? Either way, care to share any examples?
See rwmj's reference [3].
Scheme and OCaml don't have that much in common really (unless you mean derivatives like typed racket, but even then).

OWebl, in spite of its shiny website, is not what I would call "popular". You want to look at opium[1] or ocsigen/eliom [2].

Don't know what you have against OPAM, it's the best language-specific dependency manager I know.

1: https://github.com/rgrinberg/opium 2: http://ocsigen.org/eliom/

My problem with OPAM is that there's no Windows port, which makes developing OCaml programs on Windows difficult at best. In theory, we can compile all of the dependencies by hand, but in practice, the Oasis build scripts refuse to work on Windows for most packages that I've tried.

Personally, I would love to use OCaml for my company's projects, but the lack of true cross platform tooling makes it impossible at the moment.

That's a fair criticism. I think there is also an ongoing effort to make OPAM work on Windows, so this may get better in the future.
My only problem with OPAM from the precisely eight seconds I've spent looking at it: 1) unsigned packages 2) not named something goofy like "OPamL." Serious missed opportunity there, guys.
I think the daily quota of puns had been reached on that day. As for signing packages, I think it's being worked on, I remember reading something about it not that long ago.
Hum, OWebl doesn't exist. The author made some buzz because he's decent at marketing (and much better at it than the rest of the OCaml community, clearly), but it doesn't mean it's a thing.

There are other (good) web frameworks in OCaml (ocsigen, opium).

Yes, please open up the code, notice how the implementation of HTTP handling is approximately 30 lines long, and ask yourself if you would actually want to use that. ;)