4 ms·
Where is OCaml's place in the current world? I find it interesting as it seems to generate little "buzz", but has two new books this year, and is a pre-cursor
by bsg75 13y ago
Where is OCaml's place in the current world?
I find it interesting as it seems to generate little "buzz", but has two new books this year, and is a pre-cursor to another functional language that itself seems to be gaining traction, and is yet produced my Microsoft: F#
My observational / untested impression is OCaml seems to be more practical, and maybe a little easier to transition to for someone like me who uses mostly Python and Go, and a lot of bash/awk/sed/grep.
- luciafredo 13y agoHere's the other new book, which is for a different audience: (http://www.ocaml-book.com http://www.ocaml-book.com)
- bsg75 13y agoHow do the audiences differ? Experience / newcomers vs experienced? Edit: Deciding which to read first.
- edwintorok 13y agoI did read (and comment a bit) on the 'Real World Ocaml' beta book, but I've already known and used the language for quite some time before, so I can't really judge which book would be better for a beginner. Take this with a grain of salt: "OCaml from the very beginning" seems to focus more on teaching the language itself. If you've never used OCaml before then this might be the place to start. "Real World OCaml" in addition to teaching the basics of the language has some intermediate-level chapters (dealing with json, S-expressions, asynchronous events, parsing), and some advanced-level chapters (GC, compiler frontend/backend). I definitely recommend reading it at some point.
- rwmj 13y agoIt's extremely practical, and used in virtualization in the real world. Virt-* tools, Xen. See also: https://news.ycombinator.com/item?id=6711893 https://news.ycombinator.com/item?id=6711893
- edwintorok 13y agoIf you want to use a functional language on Unix, _and_ have a type system, _and_ avoid JVM/.Net then you don't have many choices. There is Haskell of course, but it is lazy by default, which makes it harder to reason about how your program will execute, and how much space it'll use. Rust is something interesting to keep an eye on, but AFAIK it is not ready yet for production use. Hence I prefer OCaml.
- mercurial 13y agoFrom the little I know of OCaml, Rust isn't really in the same category. While it has functional elements, it's really aimed at being a cleaner C++ (for instance, it doesn't have TCO).
- steveklabnik 13y agoRust was originally implemented in OCaml, though. You're correct theyre not exactly in the same category, but there is influence there.
- kenko 13y agoWhy OCaml over ML?
- edwintorok 13y agoI was shown some OCaml code at the university, so learning OCaml later seemed easier than Standard ML. Also I use Debian, and after a quick look at the repositories it has far more libraries for OCaml (-ocaml-dev) than for Standard ML, which tipped the balance in favour of OCaml as the language that I wanted to learn. Why did I stick with OCaml after that? Mostly for two reasons: there are some libraries that I like (OCamlnet, Lwt, just to mention a few), and the community appears to be more active in recent years (lots of work on build systems, packaging, new libraries coming out, user meetings, etc.). TBH I never followed the Standard ML community, so I don't know if its similar.
- mlyang 13y agoIt's a great teaching tool (so in a university/academic setting at the very least)
- agravier 13y agoI have been taught fundamental concepts of programming and programming paradigms with OCaml, and I am very grateful for that. To me, it is an expressive, clean, powerful multi-paradigm language that deserves a lot of love.
- amirmc 13y agoJane Street gets mentioned a lot but Facebook is also a user. See the recent video from CUFP. http://www.youtube.com/watch?v=gKWNjFagR9k http://www.youtube.com/watch?v=gKWNjFagR9k
- eschulte 13y agoA major limiting factor is that OCaml has no support for parallelism, and due to it's use of a global interpreter lock for GC it can't run multiple threads. That said it's great to program in (like Haskell with convenient IO and semicolons) and it compiles to blazing fast executables.
- rwmj 13y agoThis is by choice, because single thread performance matters more, and you can use fork or MPI to scale across NUMA nodes and clusters much more scalably and safely.
- eschulte 13y agoHaving used fork/join to parallelize an OCaml genetic algorithm, I can say from experience it is neither safe nor practical. Edit: Intentionally only supporting single-threaded processes is a perfectly fine design decision, however I haven't seen this argument made for OCaml, rather I've seen "multi-threading our GC would be hard" as the justification for the single-thread limitation. Admittedly it was 3-4 years ago when I last had to deal with this.
- avsm 13y agoThere are now several experimental multithreaded OCaml runtimes floating around, which also have the key property of not slowing down the single-threaded case. I don't expect multicore to remain a limitation for OCaml in 2014.
- chc 13y agoMy impression was that the core team was actively opposed to adding parallelism support. Has this changed?
- Dewie 13y agoHaskell has optional semicolons, though it probably isn't idiomatic to use them most of the time.
- lmm 13y agoI think people are starting to see the value, or at least popularity, of functional languages (Haskell/Scala/F#), and some of those are picking up OCaml as a language that fits into their workflow better - one that compiles to native binaries, without the extreme functional purity of Haskell.