osiire’s blog

ふしぎなそふとやさん

without objects!?

なにげにWadler氏のBlogを読んでたら、JaneStreetCapitalがOCamlで作ったトレードシステムの話題があった。

http://wadler.blogspot.com/2008/09/caml-trading.html

この話自体は珍しくも何ともないんだけど、JSCの人が言っていたという引用に愕然とした。

When we first tried switching over from VB to C#, one of the most disturbing features of the language for the partners who read the code was inheritance. They found it difficult to figure out which implementation of a given method was being invoked from a given call point, and therefore, difficult to reason about the code. It is worth mentioning that OCaml actually does support inheritance as part of its object system. That said, objects are an obscure part of the language, and inheritance even more so. At Jane Street, we almost never use objects and never use inheritance. We use standard functional programming techniques and code reviewers find that style more comprehensible. In particular, they can reason by following static properties of the code (module boundaries and functor
applications) rather than dynamic properties (what class an object is).

(強調は私がつけました)

継承を使わないのは分かる。オブジェクト使わないってなんだよ!?多相レコード使いたい時にJSCの人々はどうやって書いてるんだ!?

なんか、FP vs OOの構図でOO嫌いといいたいのかもしれないけど、こーゆー激しく誤解を生みそうな話を広めないでほしい。JSCの人々はせっかくすばらしい仕事して影響力あるんだから。

はい、OCamlにおけるオブジェクト、クラスはとっても大事だと思います。というか、オブジェクトなしでOCamlのプログラミングなんて考えられません。別に惹玖先生の肩を持つとかそーゆー意味でなく、純粋に技術的に。