<?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/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?"
  prev="2009/01/f038b8a453e89bfa6350495a826080fe"
  next="2009/01/fa24158b66ee08b5fc4d84873a7ad2bb"
  prev-in-thread="2009/01/f038b8a453e89bfa6350495a826080fe"
  next-in-thread="2009/01/62a2d4cfa48d2f7cdc9e412c097ea6e8"
  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 Fri, Jan 16, 2009 at 10:18:50AM -0500, Kuba Ober wrote:
[...]

OCaml?

&gt; I was always puzzled about such an argument. Scott Meyers points out
&gt; at every opportunity that in C++ (and, by extension, in OO languages
&gt; in general), the class's interface is a contract that has to be
&gt; upheld within the inheritance tree. So if something is a Foo, then
&gt; it must not matter that it's an instance that derives 5 levels deep
&gt; from Foo. If the code is written such that a derived class breaks
&gt; the contract, the code is written wrongly and will cause no end of
&gt; trouble. It's another story, of course, how to uphold such contracts
&gt; in your development environment: how much can the compiler do, how
&gt; much can the test harness do, how much is done via static code
&gt; analysis tools, etc.

I guess that's precisely the point.  It's when you're at the sharp end
of a deadline and a debugger that you need to reason about the code.
Inheritence confuses the matter greatly because the code can be spread
over many files, and in fact it may not be possible to see the code
that really gets executed.  More dynamic IDEs can help here, but the
basic problem will remain as long as people keep using inheritence.

Functors suffer from the same problem by the way, particularly when
used extensively as in the source code for camlp4.

I have a more fundamental question: Is inheritence actually useful for
anything?  By which I mean, are there real world problems which are
solved elegantly with inheritence which are otherwise difficult to
solve?  I'm not sure I've seen many.  I have seen many very tortuous
class hierarchies though.

Rich.

-- 
Richard Jones
Red Hat

</contents>

</message>

