<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2009/01/b83f81eef8ccb535ebb9797ff38dee68"
  from="Jon Harrop &lt;jon@f...&gt;"
  author="Jon Harrop"
  date="2009-01-17T22:14:04"
  subject="Re: [Caml-list] C++/C# inheritance is bad?"
  prev="2009/01/bc0b728019ecc0ed06c6c620d4829306"
  next="2009/01/e6aec16698cc330e90186b9637b316b6"
  prev-in-thread="2009/01/bc0b728019ecc0ed06c6c620d4829306"
  next-in-thread="2009/01/e6aec16698cc330e90186b9637b316b6"
  prev-thread="2009/01/7d9ffe8f9682d9fa8b4a85b38c339f33"
  next-thread="2009/01/000cddff1b409b39cd14cc392083ce8a"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="C++/C# inheritance is bad?">
<msg 
  url="2009/01/f038b8a453e89bfa6350495a826080fe"
  from="Kuba Ober &lt;ober.14@o...&gt;"
  author="Kuba Ober"
  date="2009-01-16T15:18:51"
  subject="C++/C# inheritance is bad?">
<msg 
  url="2009/01/7f3ed02f83caca6c67c43c70d569e674"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2009-01-16T15:58:08"
  subject="Re: [Caml-list] C++/C# inheritance is bad?">
<msg 
  url="2009/01/62a2d4cfa48d2f7cdc9e412c097ea6e8"
  from="Jan Kybic &lt;kybic@f...&gt;"
  author="Jan Kybic"
  date="2009-01-16T16:29:10"
  subject="On the benefits of OO, Was: [Caml-list] C++/C# inheritance is bad?">
<msg 
  url="2009/01/c69523eaafbcbe2312b568706d7a7c98"
  from="Oliver Bandel &lt;oliver@f...&gt;"
  author="Oliver Bandel"
  date="2009-01-17T12:40:24"
  subject="Re: On the benefits of OO, Was: [Caml-list] C++/C# inheritance is bad?">
</msg>
</msg>
</msg>
<msg 
  url="2009/01/6cca6c9feefd88566702defdd9eb4640"
  from="Raoul Duke &lt;raould@g...&gt;"
  author="Raoul Duke"
  date="2009-01-16T18:27:41"
  subject="Re: [Caml-list] C++/C# inheritance is bad?">
<msg 
  url="2009/01/5977e5c50685f9511c2a7aaeb88f2aaa"
  from="Kuba Ober &lt;ober.14@o...&gt;"
  author="Kuba Ober"
  date="2009-01-16T21:42:40"
  subject="Re: [Caml-list] C++/C# inheritance is bad?">
<msg 
  url="2009/01/1688f5de4636fc2a074a556bdd4e13c5"
  from="Sashan Govender &lt;sashang@g...&gt;"
  author="Sashan Govender"
  date="2009-01-17T03:14:40"
  subject="Re: [Caml-list] C++/C# inheritance is bad?">
<msg 
  url="2009/01/3da7c22bc8951acf11dc387c75d70ce3"
  from="Kuba Ober &lt;ober.14@o...&gt;"
  author="Kuba Ober"
  date="2009-01-17T14:07:23"
  subject="Re: [Caml-list] C++/C# inheritance is bad?">
<msg 
  url="2009/01/0d0df2a5f73e6806a082ed1385428205"
  from="Stefano Zacchiroli &lt;zack@u...&gt;"
  author="Stefano Zacchiroli"
  date="2009-01-18T06:24:43"
  subject="Re: [Caml-list] C++/C# inheritance is bad?">
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2009/01/bf9090ae9b10f70576fe56884cc0bb1d"
  from="Jon Harrop &lt;jon@f...&gt;"
  author="Jon Harrop"
  date="2009-01-17T13:23:25"
  subject="Re: [Caml-list] C++/C# inheritance is bad?">
<msg 
  url="2009/01/9830bc229413613d2df787f6c4190432"
  from="Kuba Ober &lt;ober.14@o...&gt;"
  author="Kuba Ober"
  date="2009-01-17T14:35:25"
  subject="Re: [Caml-list] C++/C# inheritance is bad?">
<msg 
  url="2009/01/484729b8c91b7ed08f7a809ef4800784"
  from="Jon Harrop &lt;jon@f...&gt;"
  author="Jon Harrop"
  date="2009-01-17T16:55:53"
  subject="Re: [Caml-list] C++/C# inheritance is bad?">
<msg 
  url="2009/01/bc0b728019ecc0ed06c6c620d4829306"
  from="Kuba Ober &lt;ober.14@o...&gt;"
  author="Kuba Ober"
  date="2009-01-17T21:22:22"
  subject="Re: [Caml-list] C++/C# inheritance is bad?">
<msg 
  url="2009/01/b83f81eef8ccb535ebb9797ff38dee68"
  from="Jon Harrop &lt;jon@f...&gt;"
  author="Jon Harrop"
  date="2009-01-17T22:14:04"
  subject="Re: [Caml-list] C++/C# inheritance is bad?">
<msg 
  url="2009/01/e6aec16698cc330e90186b9637b316b6"
  from="David Teller &lt;David.Teller@u...&gt;"
  author="David Teller"
  date="2009-01-17T23:29:08"
  subject="Re: [Caml-list] C++/C# inheritance is bad?">
<msg 
  url="2009/01/81422a330b59f6967afaba609aa0aa1c"
  from="Jon Harrop &lt;jon@f...&gt;"
  author="Jon Harrop"
  date="2009-01-17T23:46:02"
  subject="Re: [Caml-list] C++/C# inheritance is bad?">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2009/01/9d3495098b6736864d7a911f80eacf02"
  from="Yoann Padioleau &lt;padator@w...&gt;"
  author="Yoann Padioleau"
  date="2009-01-19T16:22:12"
  subject="Visitor in OCaml [was Re: [Caml-list] C++/C# inheritance is bad?]">
<msg 
  url="2009/01/15619ef0d6556c727c807856c0540121"
  from="blue storm &lt;bluestorm.dylc@g...&gt;"
  author="blue storm"
  date="2009-01-19T16:41:37"
  subject="Re: Visitor in OCaml [was Re: [Caml-list] C++/C# inheritance is bad?]">
<msg 
  url="2009/01/982cca226b947ab9e2f9f544aa708026"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2009-01-19T17:49:27"
  subject="Re: Visitor in OCaml [was Re: [Caml-list] C++/C# inheritance is bad?]">
</msg>
<msg 
  url="2009/01/0eb7ca2a446affb91a9277e3c12af881"
  from="Christophe TROESTLER &lt;Christophe.Troestler+ocaml@u...&gt;"
  author="Christophe TROESTLER"
  date="2009-01-19T17:52:12"
  subject="Re: Visitor in OCaml">
</msg>
<msg 
  url="2009/01/bbed03c4ad81907e983814572437326f"
  from="Yoann Padioleau &lt;padator@w...&gt;"
  author="Yoann Padioleau"
  date="2009-01-21T20:09:07"
  subject="Re: Visitor in OCaml">
<msg 
  url="2009/01/9828bde42f61b10aa9f08a2126773cd0"
  from="Yaron Minsky &lt;yminsky@g...&gt;"
  author="Yaron Minsky"
  date="2009-01-22T04:03:22"
  subject="Re: [Caml-list] Re: Visitor in OCaml">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
On Saturday 17 January 2009 21:22:19 Kuba Ober wrote:
&gt; On Jan 17, 2009, at 11:59 AM, Jon Harrop wrote:
&gt; &gt; On Saturday 17 January 2009 14:35:22 Kuba Ober wrote:
&gt; &gt;&gt; I wonder how such a hierarchy would be implemented in a natural way
&gt; &gt;&gt; in OCaml?
&gt; &gt;
&gt; &gt; Assuming you stick with accepted wisdom, you would mimic the same
&gt; &gt; effects
&gt; &gt; using OCaml's object system, just as LablGTK does. However, you have
&gt; &gt; picked
&gt; &gt; the only pedagogical OO example: GUI widgets.
&gt;
&gt; Perhaps that's where OO paradigm really shines. I'm very much against
&gt; shoehorning everything into it, of course.

We've wrapped part of WPF in a functional shim for our F# for Visualization 
product and, even though it was originally intended for internal use only, 
our customers are loving using it themselves because it is vastly simpler and 
less error prone than trying to use WPF's own heavily-imperative but entirely 
thread unsafe OOP-based API directly.

Also, specifying callbacks and event handlers as first-class functions is 
obviously preferable to an OOP-based workaround.

&gt; &gt; In contrast, metaprogramming is the pedagogical example for algebraic
&gt; &gt; datatypes. There is almost no need for users to extend the abstract
&gt; &gt; syntax
&gt; &gt; tree but there is huge value in being able to rewrite expressions
&gt; &gt; using
&gt; &gt; pattern matching. There is an idiomatic OOP solution to this problem
&gt; &gt; that
&gt; &gt; involves visitor patterns and so forth but it is comparatively
&gt; &gt; verbose,
&gt; &gt; obfuscated and unmaintainable.
&gt;
&gt; You've got me there -- I never liked the visitor pattern, and by
&gt; extension the event-based XML parsers written in C-like languages.

Oh yes. Java is utterly intolerable in that respect. I cannot believe how 
popular it became despite that...

Parallelism and concurrency are other examples where OOP sucks.

Cilk and Microsoft's TPL are the gold standards for parallel programming right 
now and both are build around concurrent work stealing queues of functions 
waiting to be applied. This works best for divide and conquer algorithms 
which, in turn, lend themselves to recursive functions. The reason being that 
older functions on a queue are more likely to be parent functions that will 
spawn many offspring, so when an idle core steals from the back of another 
core's queue it is likely to steal a parent function that will keep it busy 
for some time to come.

F#'s asynchronous workflows use monadic style to make concurrent programming 
easier.

Incidentally, Cilk looks like the ideal tool to write a parallel GC...

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e

</contents>

</message>

