Erlang vs OCaml (best niche to fit)
Asked Answered
J

5

20

Hi I'd like to pick up one FP language (it's always a pain when you work in a position that does not require you learn much), and after doing some research, I felt Erlang and OCaml are the two that I'd really like to get my feet wet for the following reasons:

1) I work mainly on high-availability web server back-end system in C++. I heard Erlang is a great fix in scalability and fault-tolerance. Though I don't think my current company will have any project in Erlang, I feel Erlang may be a good language for my long term career development.

2) I have a co-worker who is really good at OCaml, I mean he is really good at it (but he does not work on that for his daily work now. He maintains several library). So I figured that he may be a good resource if I learn OCaml.

My interests are mainly on distributed systems (my current work is some midldle-ware development work) and high-performance computing (guess what, I had a couple of years graduate school research on it, in particular PDE in Financial applications -- so I always felt I may go back to do some finance modeling work maybe sometime later)

Any suggestions? Please don't suggest "learn both", as I am not that smart :-)

Thanks

Justiciable answered 21/8, 2009 at 4:39 Comment(1)
I'm an Erlang programmer and I think it is "easy" to build "real" systems in Erlang. Systems with good reliability, stability, latency etc. Systems which can handle many clients / customers and still have a nice ande simple architecture (I wouldn't know about OCaml though, so I post this as a comment only).Economy
I
8

OCaml is a great language -- one of my favorites -- but if your interest is distributed systems than I'd recommend going with Erlang, which is head and shoulders ahead of the other FP languages with regards to distributed systems (although there's an offshoot of OCaml called Jocaml which has some interesting aspects).

OCaml is weaker even when just looking at parallelism, given its underlying architecture. Both Haskell and Clojure have better stories here, IMHO. (That said: once you get one FP language, you'll be able to carry the fundamental principles to other languages pretty easily, and they might be useful in the future. Both Scala and Clojure could easily sneak their way into organizations by virtue of the JVM.)

Ipsus answered 24/8, 2009 at 7:48 Comment(1)
For the record, OCaml has quite a different story distributed systems now, with OCaml 5's support got multicore and addition of an effects system. It's going to take a bit of time for the ecosystem to figure out exactly how to approach these new capabilities though.Jackass
P
6

I think OCaml is a great way to get started in FP, and Erlang is not very difficult once you have the basic FP concepts down.

But the suggestion from 'aneccodeal' is fantastic-- i.e., if you are interested in OCaml and have a friend who is already strong in it, by all means develop a concurrency (perhaps MPI) library for it.

Keep in mind, however, that one of the barriers to making OCaml concurrent is the lack of concurrent garbage collection (or so I have read).

Pleasance answered 16/9, 2009 at 20:59 Comment(1)
OCaml 5 brings a new garbage collector with multicore support, FWIW.Jackass
N
3

If you have a co-worker who is "really good" with OCaml then it sounds like you have a great resource assuming that s/he is willing to answer your questions. It's always easier to learn when there's someone knowledgeable around that you can ask questions of if you get stuck.

Yes it's true that OCaml doesn't have the best story when it comes to parallelism, but there are ways to get parallelism in OCaml (fork-based seems to be the most common - checkout prelude.ml which includes things like parallel map: http://github.com/kig/preludeml/tree/master ). Also, it seems that Erlang's Actor-based concurrency is really fairly easy to duplicate in other languages. Maybe you and your co-worker could work on a project to develop an Actor-based concurrency library for OCaml? That would give you a nice learning project that you co-worker would probably find interesting enough to work on with you... in addition you could end up creating something useful for the entire OCaml community.

Nappie answered 25/8, 2009 at 3:7 Comment(0)
E
2

I would also consider to look at F# (especially when VS 2010 is out). Learning a new language is a lot easier and more convenient with a nice IDE. F# and OCaml are very similar as you can see in other SO threads (e.g. here)

Entoblast answered 24/8, 2009 at 8:4 Comment(0)
B
0

While Erlang may execute slower than OCaml, it still has its advantages. For instance, if speed isn't your top priority, you can benefit from Erlang's OTP and light weight process.

Bencion answered 7/3, 2023 at 2:55 Comment(2)
With OCaml, you have the Lwt a sort of light weight process library. If you really want a light processes, OCaml 5 gave them.Rackety
Erlang is not just LWT. Its reliability framework OTP and runtime have been honed for decades, and I don't think other languages can have such a foundation.Bencion

© 2022 - 2024 — McMap. All rights reserved.