News for hackers. Stuff that matters.
Re:Why We Use OCaml by thalesmello on Monday November 16, 2015 @09:51AM (#10574696)
OCaml is a nice language and it surely has advantages. But don't treat that as a competitive advantage. All of the benefits mentioned can be easily found in other programming languages, except for maybe pattern matching, but that can be easily replaced with similar constructs.

Using a not very popular programming language can actually make it harder for you to hire people.

Re:Why We Use OCaml by junke on Monday November 16, 2015 @11:05AM (#10575147)
> Using a not very popular programming language can actually make it harder for you to hire people.

This is a very popular opinion, but I never see anyone taking the time to bring actual arguments. Do you have any experience hiring people or are you just spreading this seemingly self-evident claim?

If a language is popular, wouldn't more companies want to hire for it, which would make recruiting harder? See http://blog.activelylazy.co.uk/2013/05/27/choosing-a-program.... Also, being popular means that it is being known by a wider audience of people: isn't it harder to filter through all the applicants who say they can write in the popular language?

Re:Why We Use OCaml by mordocai on Monday November 16, 2015 @11:25AM (#10575289)
As someone currently hiring for a mid level popularity language (ruby) I find that we don't have as many applicants as we'd like and that many people who apply have ruby on their resume but have never done an actual project in it.

We also do javascript and, despite its popularity, we also get quite a few applicants who have it on their resume and have never used the language for anything useful.

Personally, my opinion is just hiring is hard. It is a very valid point though that if you are not willing to hire remote (which my company is not) you are very limited when trying to hire for less popular languages. Alternatively just train people, but that can be expensive.

Re:Why We Use OCaml by rlander on Monday November 16, 2015 @11:57AM (#10575503)
"The only thing worse than training employees and losing them is to not train them and keep them." Zig Ziglar
Re:Why We Use OCaml by padator on Monday November 16, 2015 @11:42AM (#10575409)
> Using a not very popular programming language can actually make it harder for you to hire people.

Some evidence this is just not true: http://gazagnaire.org/pub/SSGM10.pdf

Re:Why We Use OCaml by rlander on Monday November 16, 2015 @11:12AM (#10575200)
Using a not very popular programming language can actually make it harder for you to hire people.

That's a non-sequitur! The "unpopular languages make it harder to hire programmers" myth has been debunked many times right here on HN. Just hire smart people, not blub programmers.

Re:Why We Use OCaml by jlouis on Monday November 16, 2015 @11:26AM (#10575299)
One could argue that good programming languages self-select good programmers. And that there are not that many good programmers in the first place.
Re:Why We Use OCaml by rlander on Monday November 16, 2015 @11:54AM (#10575480)
That's a good point, but this argument's mostly driven by functional programmers and "good languages" usually means Haskell or Lisp, in my experience.

Disclosure: I'm a functional programmer myself so, what do I know.

Re:Why We Use OCaml by davorb on Monday November 16, 2015 @11:56AM (#10575497)
> Using a not very popular programming language can actually make it harder for you to hire people.

The type of people who go about learning OCaml are arguably on the whole more competent and passionate than your average run of the mill Java programmer. Using OCaml might be a good way to separate the wheat from the chaff.

Re:Why We Use OCaml by nv-vn on Monday November 16, 2015 @10:15AM (#10574854)
From what I've heard, Jane Street mainly (or at least often) hires developers who have never before used OCaml or even functional programming in general.
Re:Why We Use OCaml by sklogic on Monday November 16, 2015 @09:54AM (#10574711)
> that can be easily replaced with similar constructs

Mind giving an example?

> Using a not very popular programming language can actually make it harder for you to hire people.

Do you really want to work with people who can't learn a tiny little language?

Re:Why We Use OCaml by dozzie on Monday November 16, 2015 @10:37AM (#10574989)
>> that can be easily replaced with similar constructs

> Mind giving an example?

You can use, for example, elaborate if-else constructs that firstly try to determine type of the value, then check for values.

I've never seen in imperative languages anything similar to conditional that checks both type and content of an expression, and allows to capture parts of that expression into variables. Well, except for precisely the pattern matching construct, where it was implemented deliberately after functional and declarative languages (Rust).

>> Using a not very popular programming language can actually make it harder for you to hire people.

> Do you really want to work with people who can't learn a tiny little language?

I see things a little differently. It's extremely difficult to find an idiot who can write OCaml, while it's fairly easy for C++, Java, or C#.

Also, allowing people to learn OCaml and use it every day on the job is a big plus for a company. It's way better than free sandwitches for breakfast in the long run.

Re:Why We Use OCaml by loup-vaillant on Monday November 16, 2015 @01:23PM (#10576047)
> You can use, for example, elaborate if-else constructs that firstly try to determine type of the value, then check for values.

That's dynamic typing. Very different from pattern matching over sum types: with dynamic typing, you can basically forget about most compile time guarantees. Seriously, you sound like, "why bother with Ocaml when JavaScript does the same thing?". I can tell you from first hand experience that they do not feel the same at all.

The other classic example, class hierarchies, is also very different from pattern matching —and much more cumbersome. The only language I know of that kinda bridged the two is Scala, with case classes.

Re:Why We Use OCaml by dozzie on Monday November 16, 2015 @04:06PM (#10577154)
> That's dynamic typing.

No, that's run-time branch selection. Exactly as with pattern matching (`match .. with ..'), except the latter is more convenient.

> Seriously, you sound like, "why bother with Ocaml when JavaScript does the same thing?".

And you really think I consider elaborate constructions a better thing than concise pattern matching?

Re:Why We Use OCaml by sklogic on Monday November 16, 2015 @05:55PM (#10577929)
> Exactly as with pattern matching

With pattern matching you'll get static checking if your matching is exhaustive. Impossible with an if ladder. Therefore they're not semantically equivalent.

Re:Why We Use OCaml by dozzie on Monday November 16, 2015 @06:05PM (#10577983)
Static checking of a variable, value of which is determined in runtime? How can you do that?
Re:Why We Use OCaml by dragonwriter on Monday November 16, 2015 @06:16PM (#10578046)
Statically checked pattern matching validates that the provided patterns cover all possible values the variable could have (the whole space of the variables declared/inferred type). So the actual runtime value is not necessary: if the match is exhaustive, there is no possible value that could be taken at runtime that would result in no match.
Re:Why We Use OCaml by sklogic on Monday November 16, 2015 @06:17PM (#10578052)

  type 'a myOption = Some of 'a | None
  let f (Some x) = x*x

Gives this output:

  Warning 8: this pattern-matching is not exhaustive.
  Here is an example of a value that is not matched:
  None
Re:Why We Use OCaml by dozzie on Monday November 16, 2015 @06:28PM (#10578112)
Oh, now I see what you meant. But this has little to do with selecting the branch, what I was talking about the whole time.
Re:Why We Use OCaml by sklogic on Monday November 16, 2015 @06:55PM (#10578232)
Why would you care about selecting the branch in compile time? We're talking about language features semantically equivalent to pattern matching, and, turns out, there are none. As for the importance of the exhaustion check, see the billion-dollar mistake.

Your solution with type and value checks in an if ladder was called "dynamic typing" exactly for this reason - you select paths dynamically in the runtime without any static checks on soundness of this selection.

Re:Why We Use OCaml by dozzie on Tuesday November 17, 2015 @06:08AM (#10580332)
> Why would you care about selecting the branch in compile time?

I wouldn't. Pattern matching is primarly a conditional, that's why I focused on if-else.

> We're talking about language features semantically equivalent to pattern matching, and, turns out, there are none.

Why would you think that pattern matching revolves around compile-time guarantees? It does not. It's primarly a conditional, everything else is an optional, additional effect. You can have pattern matching in dynamically typed languages (Lisp, Erlang).

Re:Why We Use OCaml by rlander on Monday November 16, 2015 @11:05AM (#10575153)
You can use, for example, elaborate if-else constructs that firstly try to determine type of the value, then check for values.

That's nowhere near pattern matching. Two concepts make pattern matching vastly superior to if-else constructs:

- Non-exhaustive checks by the compiler.

- Destructuring

Re:Why We Use OCaml by dozzie on Monday November 16, 2015 @04:09PM (#10577177)
Oh, look, non-exhaustive checks are exactly as with if-else. And no, `match .. with' cannot be calculated in compilation time typically. Poor argument.

It's being a combination of destructuring, branch selection and variable assignment that makes pattern matching superior.

Re:Why We Use OCaml by sklogic on Monday November 16, 2015 @12:53PM (#10575843)
You can also do it in Brainfuck if you like, with an equivalent code bloat. Pattern matching is an order of magnitude more readable and dense than the if ladders.

As for the hiring, it is a silly idea in general to seek "programmers in XXX language" (and to position yourself as an XXX programmer). Hire programmers. Just programmers. Languages are irrelevant.