Ask Hackers: Opinions on OCaml?
21–30 of 42 posts
Re: Ask Hackers: Opinions on OCaml?
#22Re: Ask Hackers: Opinions on OCaml?
#23I've used it. I think OCaml would be a big win if you have your software designed all up front, and need to verify that it works correctly, e.g., avionics software. Unfortunately, avionics software development seems to be moving toward C/C++...
It blows my mind that in 2008 companies are moving toward C++.
"In Nov. 2003, ASTRÉE was able to prove completely automatically the absence of any RTE in the primary flight control software of the Airbus A340 fly-by-wire system, a program of 132,000 lines of C. [...] From Jan. 2004 on, ASTRÉE was extended to analyze the electric flight control codes then in development and test for the A380 series."
Re: Ask Hackers: Opinions on OCaml?
#24What's a problem is that there aren't any good books about it. Practical OCaml was almost universally panned, so I skipped it. I'd love a good book on OCaml or Haskell.
Re: Ask Hackers: Opinions on OCaml?
#25It's a loyal language because it doesn't bite you in the ass when you don't expect it. It's practical because there's a decent number of (high-quality, in general) libraries available, there are several concessions to serviceability in the language (mainly the ability to combine imperative and functional styles) and the implementation is solid and stable.
I haven't experienced the problems with the type system I've seen some people complain about. On the contrary, I've found it to be immensely helpful both when exploring new ground and when refactoring code. Deliberately breaking the code by changing a type or a function and letting the compiler guide you is a joy. In addition to other well-known benefits (Caml riders often feel that "it works as soon as it types" for a reason...) I won't repeat here, the type system (in particular the module system) sometimes makes me realize that I'm following the wrong track (I've learned to love functors after the early troubles).
Another thing I appreciate very much is the excellent performance and its predictability (other people might not care about this). The compiler doesn't (nor needs to) do deep magic the way GHC does to yield good results, so you can easily predict the performance (speed & memory usage) of your code --- and improve it when needed. Joel Raymond tells how this feels perfectly: "I would describe working with OCaml to guiding a scalpel: you move it and things happen. Right now, right here, in real-time. Compilation time is almost unnoticeable, the tool is powerful but reasonably simple. I have no problem expressing the most complex things and moving the project forward at a fast clip. I'm enjoying myself tremendously at the same time!" (Joel has switched to Erlang^H ^H^Hfactor^H^H^H K since he wrote that, though).
Expanding a bit on the Objective Caml toolset, I haven't really used ocamldebug (even though it knows some fine tricks like allowing you to go back in time...), but I often use the profiler and I've come to love camlp4, a tool that allows you to extend OCaml's grammar (I'll just say that it's very powerful, this post is already getting too long). I use the REPL mainly to explore libraries (just do "include Themodule" to see all its types & functions) or to check the type of a function (the type almost always tells you all you need to know without reading the documentation). I don't find it worse than irb --- but I rarely code inside the REPL anyway.
Now for the cons... as much as I like the language, some things could be improved:
* the standard library is a bit meager. Several third-party libs to complement/extend it exist, but there's still work left (there's some activity in the works to create a Community Distribution with richer libs).
* sometimes you feel some kind of ad-hoc polymorphism would be nice
* I've also wished a few times that the compiler were a bit smarter (inlining in higher-order functions, other classical optimizations)
* the community is very quiet: the code-to-blogging/discussion ratio is much higher than in other communities. INRIA isn't very talkative regarding its future plans for the language, and the ML has seen moderate activity historically (it's been revitalized as of late after the first OCaml Meeting)
Re: Ask Hackers: Opinions on OCaml?
#26What's a problem is that there aren't any good books about it. Practical OCaml was almost universally panned, so I skipped it. I'd love a good book on OCaml or Haskell.
Re: Ask Hackers: Opinions on OCaml?
#27Steve Yegge, who you're quoting as being in favor of OCaml, has since implied that he found it lacking on closer inspection, but, uncharacteristically, without writing at length about it.
Re: Ask Hackers: Opinions on OCaml?
#28OCaml: I like it, a lot. It's my current Favorite Language. I took the time to learn it a few years ago, and it was very, very mind-expanding. Having said that, there are a lot of constraints around real world use. Libraries, the ability to collaborate with other (blub) programmers, etc. I've used it exactly once in anger -- not on a learning/hobby project -- and although it was a resounding success, I had to go out…
As long as languages can do that, I don't see what the big deal library support is. Maybe it's just the extra tedium or something.
Re: Ask Hackers: Opinions on OCaml?
#29I've written between 50 and 100KLoCs of OCaml code over the last year (before that, I did mostly C and Ruby, which I've been using since 2002; touched many other languages but never did anything significant, over 5-10,000 lines with them). If I had to describe the language in two words, I'd say that it's practical and loyal. It's a loyal language because it doesn't bite you in the ass when you don't expect it. It's p…
Re: Ask Hackers: Opinions on OCaml?
#30I've written between 50 and 100KLoCs of OCaml code over the last year (before that, I did mostly C and Ruby, which I've been using since 2002; touched many other languages but never did anything significant, over 5-10,000 lines with them). If I had to describe the language in two words, I'd say that it's practical and loyal. It's a loyal language because it doesn't bite you in the ass when you don't expect it. It's p…