What's it good for? Why should I use it? Why is it a better choice than language X or Y?
What's it good for? Why should I use it? Why is it a better choice than language X or Y?
https://realworldocaml.org/v1/en/html/prologue.html#why-ocam...
"Among this worthy set of languages, OCaml stands apart because it manages to provide a great deal of power while remaining highly pragmatic. The compiler has a straightforward compilation strategy that produces performant code without requiring heavy optimization and without the complexities of dynamic just-in-time (JIT) compilation. This, along with OCaml's strict evaluation model, makes runtime behavior easy to predict. The garbage collector is incremental, letting you avoid large garbage collection (GC)-related pauses, and precise, meaning it will collect all unreferenced data (unlike many reference-counting collectors), and the runtime is simple and highly portable."
Imagine something that can compete with C and C++, but doesn't require all of the low-level reinvention and memory management. It's like a high-level language for smart people that doesn't feel entirely impractical. It has some things that people bitch about (like having to use +. to add two floats and + to add two ints), which don't really bother me that much.
If it were more popular and had better libraries/platform support (unless that's changed drastically in the past year or so), it would be a serious contender for general development. Being completely honest, I think Jane Street is probably the biggest organization pulling OCaml, and from a navel-gazing standpoint you can either view that as good or bad.
Use it because you learned it and thought it didn't suck, I guess?
EDIT: changed some phrasing
Thanks for your work.
Actually a lot has happened in the last year or so. If you're not aware of it, you could start by looking over the end-of-year post from OCaml Labs [1]. I'm aware that it's difficult to keep a central overview of all the progress but there is a lot of work being done, in many ways, to improve the ecosystem.
[1] http://www.cl.cam.ac.uk/projects/ocamllabs/news/#Dec%202013
What is clear is that we spend a lot of time fixing type errors in JavaScript due to the lack of basic type checking. Java does not have this problem and for Android programming it is a breeze since really the mobile app is just a GUI which doesn't have to do anything clever with the data.
Now the backend is in charge of serving correct data to the client apps. I could explain that OCaml is fast and lets us implement any CPU-intensive algorithm without having to switch to C, but the truth is most of our code is not much about algorithms but very much about data modeling and data management. Anything we store needs to be stored correctly if we don't want to accumulate broken data resulting in bugs that are costly to fix. Untyped languages such as JavaScript let you store anything without checking their conformance to a type definition, this is awful. Java for example would be perfectly acceptable if it wasn't so verbose. We want to write JSON-like records and arrays like in JSON or JavaScript. OCaml provides this, Java doesn't.
Now, we don't want half of our code to consist in annotating each variable with a type. The compiler should infer that 123 is an int. How hard is that? You tell me. JavaScript doesn't check anything. Java or C++ force you to declare that 123 is an int. How clever is that? I don't know. OCaml, Haskell just figure out that 123 is an int. That's called type inference. That makes code readable like JavaScript or Python, with the safety of Java and the performance of C++.
From my perspective it seems like there is more activity and research going on in Haskell.
Isn't that enough to choose OCaml over Haskell?
Real World OCaml is that, without totally being it. The authors wrote it with the idea in mind that only people with a good background about functionnal world can read it.
I'd add that lazyness can be a good thing and that the type-system of Haskell is better than the OCaml one.
Any reason to try OCaml for Android development? Looked at Ocaml-Java?
Alternatives that we've been considering include js_of_ocaml and TypeScript.
http://roscidus.com/blog/blog/archives/
It has been previously discussed on HN and Reddit.
From what I can understand in the SkillsThatMatter sessions, the finance and insurance sector in some European countries are big users.
The applications aren't full ML stacks, just the algorithms are done with them, with the UIs using a more traditional one.
Might not seem much, but it already a foot in the door.