<?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="2002/07/d8d8048f18fde67a30d15fff45a35cd0"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-16T11:01:06"
  subject="Re: [Caml-list] Recovering masked methods (with CamlP4?)"
  prev="2002/07/bdc2038f2220ce701049a9e8d6a5abc9"
  next="2002/07/b59eca1b7e5590da95546ae14fabfec6"
  prev-in-thread="2002/07/a4e7111559c35cc347dce02da761c6d4"
  next-in-thread="2002/11/016e4090efb8e82cad8d8d8247cc1f70"
  prev-thread="2002/07/f588263f2499215c76c4696e61086612"
  next-thread="2002/07/ca2a3e0a12658384bdc94c4ad62eb59b"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Recovering masked methods">
<msg 
  url="2002/07/2fe55408b32aa0c8bbfe694c2fc4d83a"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-15T23:06:46"
  subject="[Caml-list] Recovering masked methods">
<msg 
  url="2002/07/dc0f73cee705120e47f611b302d2229c"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2002-07-16T01:15:48"
  subject="Re: [Caml-list] Recovering masked methods">
<msg 
  url="2002/07/17972e65a4fa6e1be37544c22613850e"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-16T09:21:43"
  subject="Re: [Caml-list] Recovering masked methods">
<msg 
  url="2002/07/4bbe8c44332ba5a3150f66f671c75eaa"
  from="Laurent Vibert &lt;lvibert@i...&gt;"
  author="Laurent Vibert"
  date="2002-07-16T09:48:33"
  subject="Re: [Caml-list] Recovering masked methods">
<msg 
  url="2002/07/cdb48831ef99b8f2f30bb2c41cfffc21"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-16T10:03:53"
  subject="Re: [Caml-list] Recovering masked methods">
</msg>
<msg 
  url="2002/07/09f0c8681907e8992348940da99cad75"
  from="Johan Baltié &lt;johan.baltie@w...&gt;"
  author="Johan Baltié"
  date="2002-07-16T10:08:20"
  subject="Re: [Caml-list] Recovering masked methods">
</msg>
</msg>
<msg 
  url="2002/07/a4e7111559c35cc347dce02da761c6d4"
  from="Johan Baltié &lt;johan.baltie@w...&gt;"
  author="Johan Baltié"
  date="2002-07-16T09:59:43"
  subject="Re: [Caml-list] Recovering masked methods">
<msg 
  url="2002/07/d8d8048f18fde67a30d15fff45a35cd0"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-16T11:01:06"
  subject="Re: [Caml-list] Recovering masked methods (with CamlP4?)">
<msg 
  url="2002/11/016e4090efb8e82cad8d8d8247cc1f70"
  from="Eray Ozkural &lt;erayo@c...&gt;"
  author="Eray Ozkural"
  date="2002-11-12T19:47:58"
  subject="Re: [Caml-list] Recovering masked methods (with CamlP4?)">
</msg>
<msg 
  url="2002/07/b59eca1b7e5590da95546ae14fabfec6"
  from="Johan Baltié &lt;johan.baltie@w...&gt;"
  author="Johan Baltié"
  date="2002-07-16T11:32:44"
  subject="Re: [Caml-list] Recovering masked methods (with CamlP4?)">
<msg 
  url="2002/07/079c1f77e6e6ffdeb3b3e90ab408aff5"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-16T12:45:21"
  subject="Re: [Caml-list] Recovering masked methods (with CamlP4?)">
</msg>
</msg>
<msg 
  url="2002/07/3de0fe9da97cf529cecbfd91303a3bd0"
  from="Daniel de Rauglaudre &lt;daniel.de_rauglaudre@i...&gt;"
  author="Daniel de Rauglaudre"
  date="2002-07-16T12:26:56"
  subject="Re: [Caml-list] Recovering masked methods (with CamlP4?)">
<msg 
  url="2002/07/3010b130a14bbcce52ad13d282b7bc8e"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-16T12:47:43"
  subject="Re: [Caml-list] Recovering masked methods (with CamlP4?)">
<msg 
  url="2002/07/b81da613b70144f0000c305c48fda6a9"
  from="Daniel de Rauglaudre &lt;daniel.de_rauglaudre@i...&gt;"
  author="Daniel de Rauglaudre"
  date="2002-07-17T09:26:40"
  subject="Re: [Caml-list] Recovering masked methods (with CamlP4?)">
</msg>
</msg>
</msg>
<msg 
  url="2002/07/e7cc3630ab3efd751fb7ab23ee8cd246"
  from="John Prevost &lt;j.prevost@c...&gt;"
  author="John Prevost"
  date="2002-07-16T13:25:28"
  subject="Re: [Caml-list] Recovering masked methods (with CamlP4?)">
<msg 
  url="2002/07/64938492e1b530128ae42eb730af62b2"
  from="John Prevost &lt;j.prevost@c...&gt;"
  author="John Prevost"
  date="2002-07-16T13:28:39"
  subject="Re: [Caml-list] Recovering masked methods (with CamlP4?)">
</msg>
<msg 
  url="2002/07/22bfb44ade56966015ca1e7b98b02394"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-16T13:59:43"
  subject="Re: [Caml-list] Recovering masked methods (with CamlP4?)">
<msg 
  url="2002/07/4b34e2322a3787668e7cc44878eaae57"
  from="Johan Baltié &lt;johan.baltie@w...&gt;"
  author="Johan Baltié"
  date="2002-07-16T14:15:50"
  subject="Re: [Caml-list] Recovering masked methods (with CamlP4?)">
<msg 
  url="2002/07/429a6ddd7c1da1d3259de9ec4b1a2c13"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-16T14:22:35"
  subject="Re: [Caml-list] Recovering masked methods (with CamlP4?)">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2002/07/bdc2038f2220ce701049a9e8d6a5abc9"
  from="John Prevost &lt;j.prevost@c...&gt;"
  author="John Prevost"
  date="2002-07-16T10:38:38"
  subject="Re: [Caml-list] Recovering masked methods">
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
Johan Baltié wrote:
&gt; 
&gt; I do not agree with you on the usefullness of this kind of stuff.
&gt; Basic OO theory says that the inheritance relation can be seen as a "is a" operator.
&gt; 
&gt; If your "is a" means "is a with some variants", for me your modelization is not
&gt; good.
&gt; 
&gt; You should have:
&gt; 
&gt;  B' inherits A 
&gt;  B inherits B'
&gt;  small_b_variant inherits B'
&gt; 
&gt; Like this code factorisation seems to be easy to do. 
&gt; 
&gt; IMHO it's a good modelization constraint to forbid such stuff.

I strongly disagree. Inheritance, as pointed out previously 
by someone on this list (I can't remember whom), is a 
syntactic property of classes, whereas subtyping is a 
semantic property of instances. Just now I have received a 
post by John Prevost clarifying this.

In my code,
class a = object method m = ... end
Provides basic functionality common to all my inheritance 
hiearchy. Class a *also* defines the actual type of all my 
inheritance hieararchy, so I do not use subtyping at all; I 
use type *identity*. That's because I'm building a graph of 
objects of different classes, so all the objects in the 
graph need to have the same type. I only use inheritance 
because of code sharing. Now,
class b = object inherit a ... end
performs extensive personalizations to the functionality 
provided by class a, while always retaining the 
functionality of the parent, which is accessed by sending 
messages to super_a. Class var_b needs most of the 
functionality provided by b, with the sole exception of one 
method, which I call here m, which needs to be identical to 
the one defined in the root of the hierarchy. Hence, for the 
sake of code reuse, since var_b shares most of its code with 
b, it must inherit from b; however, for the sake of not 
having multiple copies of the same lines of code--a 
maintainance issue--I *also* need var_b to inherit, albeit 
indirectly, form a. This is my reason for requesting and 
"explicit inheritance hierarchy" construct. I think it 
should pose no semantic issues with the OO system of Caml. 
It should simply allow explicit scoping of inherited 
methods. Please, note that it is merely a bit of syntactic 
sugar. To think of it, it might even be implemented with CamlP4.

CamlP4 could perform the following code transformation:
class a =
object
   method m = &lt;some stuff&gt;
end

to
class a =
object
   private method __class_a__m = &lt;some stuff&gt;
   method m = self # __class_a__m
end

and

class var_b =
object
   inherit a as super_a through b as super_b
   method m = super_a # m
end

to

class var_b =
object
   inherit b as super_b
   method m = __class_a__m
end

Daniel, I'm no CamlP4 guru. Would this scheme work?

Alex

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

