7 ms·
Real World OCaml
- brokenparser 13y agoDebian describes OCaml as follows: Objective Caml (OCaml) is an implementation of the ML language, based on the Caml Light dialect extended with a complete class-based object system and a powerful module system in the style of Standard ML. OCaml comprises two compilers. One generates bytecode which is then interpreted by a C program. This compiler runs quickly, generates compact code with moderate memory requirements, and is portable to essentially any 32 or 64 bit Unix platform. Performance of generated programs is quite good for a bytecoded implementation: almost twice as fast as Caml Light 0.7. This compiler can be used either as a standalone, batch-oriented compiler that produces standalone programs, or as an interactive, toplevel-based system. The other compiler generates high-performance native code for a number of processors. Compilation takes longer and generates bigger code, but the generated programs deliver excellent performance, while retaining the moderate memory requirements of the bytecode compiler. It is not available on all arches though.
- rwmj 13y agoIt is not available on all arches though. Although in practices the arches that lack a native OCaml compiler don't matter. In RHEL we ship OCaml natively for everything except S/390 and AArch64. AArch64 will be important, but since hardware doesn't exist in a form you can buy for servers, we're happy to wait for upstream to implement this. We'll probably help them out with hardware too. Edit: We maintain our own PPC64 backend.
- avsm 13y agoXavier Leroy committed experimental native AArch64 support to OCaml trunk over the summer. I'm planning to add it to the OPAM package testing pool as soon as I get my hands on some Calxeda (or other) hardware. https://github.com/ocaml/ocaml/tree/trunk/asmcomp/arm64 https://github.com/ocaml/ocaml/tree/trunk/asmcomp/arm64
- apaprocki 13y agoWe actively use/used OCaml in production on SPARC/Solaris, POWER/AIX, HP-UX/IA64. (The optimized compiler wouldn't build on AIX.)
- jgw25 13y agoThere's an AIX port of 3.12.1 http://ocaml-ports.geschenker.net/ocaml-aix.html http://ocaml-ports.geschenker.net/ocaml-aix.html
- rwmj 13y agoVarious backends for less used architectures are maintained out of tree, eg here: https://github.com/retired-camels/ocaml https://github.com/retired-camels/ocaml
- weavie 13y agoThis is a really good presentation on OCaml by one of the authors of this book. http://youtu.be/hKcOkWzj0_s http://youtu.be/hKcOkWzj0_s
- tizoc 13y agoAnother one: Effective ML http://vimeo.com/14313378 http://vimeo.com/14313378
- edwintorok 13y agoI find the recent ocaml meeting presentations quite useful and interesting too, in the sense that it presents what people are using OCaml for, and what tools people are working on: http://ocaml.org/meetings/ocaml/2013/program.html http://ocaml.org/meetings/ocaml/2013/program.html http://oud.ocaml.org/2012/ http://oud.ocaml.org/2012/
- deleted 13y ago[deleted]
- SkyMarshal 13y ago>(Though to my understanding, Jane Street capital, a proprietary trading firm, is the only company that uses this language in real world applications) http://ocaml.org/companies.html http://ocaml.org/companies.html
- bsg75 13y agoWhere 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
- 13y ago
- cju 13y agoHere is a description of OCaml usage at Jane Street : https://queue.acm.org/detail.cfm?id=2038036 https://queue.acm.org/detail.cfm?id=2038036 ocaml.org have a list of users: http://ocaml.org/companies.html http://ocaml.org/companies.html Some "big" companies in the list: Facebook, Citrix, Dassault Système.
- avsm 13y agoAnother cool one from CUFP this year is how Facebook is using OCaml to add incremental type inference to their vast PHP code base. There's (slightly hard to see video) here, but I'm sure Facebook will publicize it more widely when they're ready. http://www.youtube.com/watch?v=gKWNjFagR9k http://www.youtube.com/watch?v=gKWNjFagR9k
- pjmlp 13y agoYou missed Microsoft :) http://caml.inria.fr/consortium/index.en.html http://caml.inria.fr/consortium/index.en.html
- e12e 13y agoThat acm article was very interesting, than you! Lots of nice little concrete examples - that are simple, yet not too simple. I've yet to play much with ocaml — we had a bit of standard ml in our programming paradigms-class at university (at the time the course used [1] "Programming Languages: Concepts and Constructs (2nd Edition) by Ravi Sethi" — now they've (unfortunately, yet understandably) replaced standard ml with Haskell). I've since had a little trouble adapting to similar-yet-different languages like both Haskell and OCaml. [1] http://www.amazon.com/Programming-Languages-Concepts-Constructs-Edition/dp/0201590654 http://www.amazon.com/Programming-Languages-Concepts-Constru...
- avsm 13y agoFor anyone curious to hear more and is at QCon SF today, I'll be speaking about a new library operating system we've been building in OCaml for the past few years. The slot is in a couple of hours at 1030 PST. qcon link: http://qconsf.com/presentation/my-other-internet-mirage http://qconsf.com/presentation/my-other-internet-mirage my slides: http://decks.openmirage.org/qcon13/ http://decks.openmirage.org/qcon13/
- pjmlp 13y agoAlso interesting read, "Unix system programming in OCaml", http://ocamlunix.forge.ocamlcore.org/ http://ocamlunix.forge.ocamlcore.org/
- edwintorok 13y agoAlthough not a book per-se, the tutorials on the OCaml.org site are based on the old ocaml-tutorial.org ones, which is among the ones I used to get started (there was no Real World OCaml, or OCaml from the Very Beginning at the time): http://ocaml.org/tutorials/ http://ocaml.org/tutorials/ For future reference, all books should be listed here: http://ocaml.org/books.html http://ocaml.org/books.html
- ralphc 13y agoIn my progression of Haskell-OCaml-Common Lisp-Clojure-Scala, I remember OCaml having odd edge cases, modules of functors or some such that didn't really help me in solving real world problems (this was 2007-2008 so my memory could be off). I'm currently a fan of Scala, which has all the functional and Algebraic Data Type goodness I remember from OCaml but is more "practical", more companies and projects are using it, plus I work in the JVM ecosystem. Any reason to go to OCaml now instead of Scala?
- avsm 13y agoMarius Eriksen (who leads a lot of the Scala work at Twitter) gave us a great quote for the back of the book that says it best. Programmers are digital choreographers, carefully balancing correctness, modularity, concurrency, and performance. Real World OCaml teaches you how to perform this balancing act in simple, elegant ways. OCaml's the simplest systems language I've ever used with a decent static type system to prevent common errors from creeping into your code (most other systems languages sacrifice modularity in favour of even more simplicity, but OCaml strikes a balance).
- tomp 13y agoFor me, OCaml is just easier on the eyes. For example, compare ADT declaration in OCaml vs. Scala case classes.
- elehack 13y agoIt depends on what you are working on. OCaml lets you interact more closely with Unix and with C libraries, if you need that. It also has a lot faster startup time and lower memory overhead, making it somewhat more suitable for writing Unix-style programs that need to run quickly with low overhead. I also moved from OCaml to Scala for my primary programming, and have really enjoyed it. The functional goodness on top of JVM is a major win for the kinds of things that I primarily work on these days. When I was working with OCaml, the community was going through a lot of work on figuring out what the ecosystem should look like. This involved at least two competing standard library extensions or replacements (Batteries and Jane St. Core), growing pains in packaging & deployment, etc. The language was (and still is) nice, but I could not, at the time, invest the time into dealing with the ecosystem. Things seem to have improved a lot since then, particularly with things like OPAN emerging, but Scala is still a better fit for the work I do, and Haskell has been serving me well for command-line kinds of things. But OCaml is a fine, practical language for a lot of things.
- srean 13y agoFor the early adopters and experimenters amongst you, you might like Felix http://felix-lang.org/share/src/web/tutorial.fdoc http://felix-lang.org/share/src/web/tutorial.fdoc It is a whole program optimized, strongly typed, polymorphic, ML like language that can interact effortlessly with C and C++ code and has coroutines baked in. Its own demo webserver is based on coroutines. It uses a mix of lazy and eager evaluation for performance and compiles down to C++. Execution speed is comparable to C++, mostly better. Its grammar is programmable in the sense that it is loaded as a library. With inaccuracies in analogies assumed, Felix is to C++ what F# is to C# or to some extent Scala is to Java. It is also mostly a one man effort but with a feverish pace of development so it comes with its associated advantages and disadvantages. Tooling info is here http://felix-lang.org/share/src/web/tools.fdoc http://felix-lang.org/share/src/web/tools.fdoc The author likes to call it a scripting language but it really is a fullfledged statically compiled language with a single push button build-and-execute command. http://felix-lang.org/ http://felix-lang.org/ The "fastest" claim is a bit playful and tongue in cheek, but it is indeed quite fast and not hard to beat or meet C with.
- deleted 13y ago[deleted]
- mercurial 13y agoI had a look at it and it sounded pretty cool. The one thing I found unfortunate is the lack of separation between safe and unsafe code, but it certainly has a lot going for it.
- srean 13y agoYeah, that is D's strength, that and compile time function execution.
- skaller 13y agoThere's no such thing as safe code. So to do as you suggest requires some set of suitable concepts of relative safety, together with some way to enforce them. I am very interested in implementing mechanisms that provide guarantees. And not just safety. Another would be licence management (e.g allow only BSD licenced code to be used) .. that's a legal safety guarantee :)
- ori_b 13y agoOcaml: Love the language, but I don't think I've seen a worse standard library. I don't mean that it's sparse -- I don't mind that so much. I mean that it's really just badly designed. For example, global, mutable variables in a functional language? Really? Thankfully, Jane Street and the Batteries Included projects are supplementing it, but I'm still of the opinion that the standard library should be torn out and replaced with something nice.
- avsm 13y agoIt's important to remember that the standard library is the compiler standard library. It's actually very useful to have it be so minimal when compiling OCaml to odd embedded and microkernel targets (such as our own MirageOS at https://openmirage.org https://openmirage.org). We took an explicit decision not to use the compiler standard library in Real World OCaml, and instead work using the Core stdlib from Jane Street. I think it's quite a testament to the modular power of OCaml that they managed to not only separate the standard library from millions of lines of internal code, but also to make it so usable for external users in a brief 12 months. There are a lot more developments coming soon, of course: see my groups research page at http://ocaml.io http://ocaml.io for some of the projects. I've been lapse at updating it in the past few months, but normal service shall resume very shortly...
- edwintorok 13y agoEven if you don't use / plan to use the Core stdlib, the book is quite useful.
- technomancy 13y agoI was pretty impressed with how a single `open Core.Std` line you can basically do the whole "tear out the standard library and replace with something nice" on a per-module basis. Unfortunately it has the side-effect of making small native binaries impossible, but depending on the project it's nice to have the choice.
- avsm 13y ago
- deleted 13y ago[deleted]
- jzelinskie 13y agoCrazy coincidence; I just met someone who works at Jane Street on Saturday. My jaw pretty much dropped when he told me what his company does. When I got home and did some research, I was blown away by their dedication. I'm very happy to see a company realize the value in their language ecosystem and contribute as much back as they have.
- cgag 13y agoPeople asking about Golang may be interested in this article, where someone considering rewriting a large python project choose a new language, where both Golang and OCaml are among the candidates. http://roscidus.com/blog/blog/2013/06/09/choosing-a-python-replacement-for-0install/ http://roscidus.com/blog/blog/2013/06/09/choosing-a-python-r...
- LukeHoersten 13y agoIn case anyone's interested, there's also a Real World Haskell book freely available to read online: http://book.realworldhaskell.org/read/ http://book.realworldhaskell.org/read/ I'd be interested to see how they compare.