Re:Why should I have written ZeroMQ in C, not C++
by gaius on Thursday May 10, 2012 @10:21AM
(#3953615)
Well, yes and no. I know more about OCaml than Erlang, but pattern matching and guards let you be very sure that a function is going to handle every possible input, and static typing means all code paths can be verified at compile time - there's no way into or out of a function without the program being in a valid state.
[ Parent
| on HN ]
Re:Why should I have written ZeroMQ in C, not C++
by Drbble on Thursday May 10, 2012 @12:42PM
(#3954437)
What about, say, a function that puts ten elements into a list that needs to get sent a receiver that only expects nine ? Or a network call that returns an unparseable reply?
Re:Why should I have written ZeroMQ in C, not C++
by gaius on Thursday May 10, 2012 @01:24PM
(#3954702)
In the first case, I wouldn't use a list for that, but a record/struct/class with 9 fields. In the second, I would use an Either/Maybe type, or raise an exception (these work differently in OCaml than in C++)