Live data from Hacker News

Why We Use OCaml

tech.esper.com

61–70 of 144 posts

Re: Why We Use OCaml

#61
post #28

Interesting list. I'm curious if the author has looked at Rust and how they think it stacks up. Rust is obviously still pre-1.0, and it doesn't have an identical feature list, but it seems to me to perhaps be a lot more practical for a lot of work than OCaml (largely because Rust can basically be used anywhere C++ can be, and it has good support for C FFI).

Why do you think Rust is applicable, here? It isn't obvious to me that these people would benefit from a language that can be used anywhere that C++ can be.

Re: Why We Use OCaml

#62
post #28

Interesting list. I'm curious if the author has looked at Rust and how they think it stacks up. Rust is obviously still pre-1.0, and it doesn't have an identical feature list, but it seems to me to perhaps be a lot more practical for a lot of work than OCaml (largely because Rust can basically be used anywhere C++ can be, and it has good support for C FFI).

I think that, having used both of them, Rust is going to feel a lot lower level than OCaml. The single biggest thing is that it's pretty hard (slash near impossible) to write Rust code without thinking about memory allocation, which adds non-trivial mental overhead to the work. That isn't to put down Rust - I think they are the first language that actually has a static, type-checkable story about memory allocation, a…

[deleted]

Re: Why We Use OCaml

#63
Hey HNers, I'm the CEO of Esper - there's been a lot of questions regarding the business case for OCaml and I think it'd be helpful to write here:

1) It's practical - for our team, we had developed in it before and had deployed a large system in it - we could get to where we wanted quickly.

2) we think it's a competitive advantage (see OP and PG's Beating the Averages essay) - additionally, since we deal with large amounts of data, OCaml was particularly helpful in that regard too

3) OCaml is a good filter - the thing that matters more to us is a person's elasticity of learning - their ability to learn new things. We use the right tool for the right job, so we also use javascript, java, objective-C, etc. OCaml is a pretty good filter and test for elasticity of learning.

Lastly, not a primary reason, but an advantage - languages get popular because the companies that use them are popular (i.e. gain market traction and can pay developers). That doesn't mean it's the most efficient way to get things done. We'd like to be part of the group that helps make the industry more efficient.

Re: Why We Use OCaml

#64
post #63

Hey HNers, I'm the CEO of Esper - there's been a lot of questions regarding the business case for OCaml and I think it'd be helpful to write here: 1) It's practical - for our team, we had developed in it before and had deployed a large system in it - we could get to where we wanted quickly. 2) we think it's a competitive advantage (see OP and PG's Beating the Averages essay) - additionally, since we deal with large a…

There are many additional reasons that impact the maintenance of established code bases and code reuse. OCaml's Module system is good in this regard.

In addition, there are many other companies that use functional languages and my (subjective) experience had been that such orgs are able to achieve far more with smaller teams (cf Whatsapp and Erlang). Facebook and Bloomberg are also users. I find it somewhat bizarre that people are making an issue of the business case for using OCaml in a startup. How many people did that before using Python/Ruby/etc back in the day?

Edit: and here's a clicky link to PG's essay http://www.paulgraham.com/avg.html

Re: Why We Use OCaml

#65
post #43

Earlier quoted context omitted.

But there is a strong community behind OCaml. A lot of undergraduate programs use a dialect of ML for their core classes. While most OCaml implementations have poor standard libraries, Jane Street Capital has released several open source libraries that make it easy to implement high quality, performant applications.

> But there is a strong community behind OCaml. A lot of undergraduate programs use a dialect of ML for their core classes I don't understand your response. Are you saying the OCaml community primarily consists of undergraduates? > While most OCaml implementations have poor standard libraries That right there should tell you something.

>> While most OCaml implementations have poor standard libraries

> That right there should tell you something.

I wouldn't use that as the main criteria to judge a language. C has a poor standard library (for a definition of "poor" relative to, say, python) and so does C++. But they are certainly useful tools in their domains.

In any case, OCaml has a couple of standard library replacements/augmentations that reduce the gap a bit. (Batteries Included [1] and Jane Street's Core [2])

[1] https://github.com/ocaml-batteries-team/batteries-included/

[2] https://github.com/janestreet/core and https://github.com/janestreet/core_kernel

Re: Why We Use OCaml

#66

Earlier quoted context omitted.

F# is an ML without any of the things which make ML good (modularity). It's a breath of fresh air if you're on a Microsoft platform, but if you can use OCaml, it is superior.

Hey Jon, being an F# user who is not very familiar with OCAML, I'd love to know a little more about what specifically F# lacks that makes OCAML superior. I want to know what I'm missing out on.

Functors (also known as parameterized modules). See: http://ocaml.org/learn/tutorials/modules.html

Re: Why We Use OCaml

#67
post #41

> OCaml includes many features that are not available in the more mainstream programming languages ... and we believe this gives us a competitive advantage. ... The purpose of this post is to explain the benefits of OCaml and compare it to other languages. We hope to convince readers, especially other developers, to consider adopting OCaml for their projects as well. The authors did a great job explaining the benefit…

I often hear how using how using less mainstream and more difficult to learn (as in requires some mind warping if coming from more mainstream language) languages acts as a filter that will leave more capable programmers to choose from, even if there are less of them. Does anyone know if there have been studies to back this up? Or studies that back up the above comment. My experience is that programmers who enjoy warp…

I would agree that in my personal experience, those people do tend to be quite intelligent. However, I have not found them to be more productive (and in some cases, they seem to be less productive, because they spend so much time fiddling and tweaking instead of just finishing things).

Re: Why We Use OCaml

#68
post #3

What are some advantages of OCaml over Haskell?

I would say Ocaml code is much easier to understand as a beginner than Haskell. Even with context I've never been able to just look at some production haskell and get the gist quickly. Ocaml takes work, but I at the very least have an idea of what's going on after giving a chunk of code a once-over.

Here's an example: http://llvm.org/docs/tutorial/OCamlLangImpl1.html

Re: Why We Use OCaml

#69

> OCaml includes many features that are not available in the more mainstream programming languages ... and we believe this gives us a competitive advantage. ... The purpose of this post is to explain the benefits of OCaml and compare it to other languages. We hope to convince readers, especially other developers, to consider adopting OCaml for their projects as well. The authors did a great job explaining the benefit…

While your mileage will vary depending on the nature of your startup, I can point you to a paper we wrote summarising our experiences using OCaml to build the XenServer toolstack in a startup environment [1].

You should bear in mind that OCaml represents almost twenty years of continuous development (see the history chapter in Real World OCaml [2]), with a community steeped in some of the most cutting edge technology in modern programming languages (e.g. the Coq theorem prover or the CompCert certified C compiler).

I was the startup manager at XenSource that took the risk, and all of your points were not true for us:

- by joining the Caml Consortium (very cheap), we got access to the core developers and a yearly face-to-face. We're talking about Xavier Leroy and Damien Doligez here. Do you get that with Java?

- the compiler and runtime are utterly rock solid and engineered for a modern Unix environment. We found more serious gcc bugs (5+) than OCaml bugs (one, to do with compiling functions with >32 arguments, and was already fixed in trunk and a backport available inside a day).

- Hiring OCaml developers gave us the cream of the crop even for entry level jobs, and I work with several of the original team that we assembled to this day. See the paper [1] for details on several of the responses from within the company and how we responded.

- The OCaml community is very pragmatic, since the language is used in quite a few large codebases like Coq, CompCert, Why3, XenServer, Pfff (Facebook) as well as closed-source codebases such as Jane Street and Lexifi's. Most language evolution discussions are evaluated against these large users. I consider OCaml rather unique in that, despite being a small community, the ones that do use it do so seriously and often at scale.

I find it amusing that so-called "risk-averse" startup managers discount a 20-year old language with legendary stability in favour of relatively new languages. Nothing beats having developers that deeply understand their language and libraries, and that's only imparted with age and stability.

I would also note that being based in Cambridge, it's quite easy to grads that know ML (and the same is true in many US universities that teach OCaml, like Cornell, Harvard, Princeton and Yale).

[1] http://anil.recoil.org/papers/2010-icfp-xen.pdf

[2] https://realworldocaml.org/v1/en/html/prologue.html#a-brief-...

Re: Why We Use OCaml

#70

Earlier quoted context omitted.

F# is an ML without any of the things which make ML good (modularity). It's a breath of fresh air if you're on a Microsoft platform, but if you can use OCaml, it is superior.

Hey Jon, being an F# user who is not very familiar with OCAML, I'd love to know a little more about what specifically F# lacks that makes OCAML superior. I want to know what I'm missing out on.

I've never used F#, but I found an SO question [0] which provided the following:

- Functors (https://realworldocaml.org/v1/en/html/functors.html)

- OCaml-style objects (https://realworldocaml.org/v1/en/html/objects.html)

- Polymorphic variants (https://realworldocaml.org/v1/en/html/variants.html#polymorp...)

- The camlp4 preprocessor (https://realworldocaml.org/v1/en/html/the-compiler-frontend-...)

- Stronger guarantees from type system. F# allows null values, it seems, while you would need to use an Option type in OCaml.

[0] http://stackoverflow.com/questions/179492/f-changes-to-ocaml

Post reply on HN