<?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/f178655b06c3af22c50aee33163cd56f"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-16T04:48:07"
  subject="Re: [Caml-list] Five Questions about Objects"
  prev="2002/07/2737a7cea2fd0851c3767abc9726e20b"
  next="2002/07/2566e8fca11985284fc23a3afc3f86e1"
  prev-in-thread="2002/07/2737a7cea2fd0851c3767abc9726e20b"
  prev-thread="2002/07/e2f2b258abd0d3497431776b34442703"
  next-thread="2002/07/5a07099df93b470f2f48a69d7d4bf4a2"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Five Questions about Objects">
<msg 
  url="2002/07/159ef0ccc84f7c657489db370903e327"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-13T13:40:58"
  subject="[Caml-list] Five Questions about Objects">
<msg 
  url="2002/07/e609d5c80b3292d73cadaef94b22faa1"
  from="YAMAGATA yoriyuki &lt;yoriyuki@m...&gt;"
  author="YAMAGATA yoriyuki"
  date="2002-07-14T02:01:08"
  subject="Re: [Caml-list] Five Questions about Objects">
<msg 
  url="2002/07/88ceff20a8333237e0473e41d8ebf755"
  from="Alain Frisch &lt;frisch@c...&gt;"
  author="Alain Frisch"
  date="2002-07-14T08:58:25"
  subject="Re: [Caml-list] Five Questions about Objects">
<msg 
  url="2002/07/2bd49e9e3d2bfef1b3b0efd6d37d8010"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2002-07-14T09:39:06"
  subject="Re: [Caml-list] Five Questions about Objects">
<msg 
  url="2002/07/7e73c73d2257ab2c68a534ee7340330c"
  from="William Lovas &lt;wlovas@s...&gt;"
  author="William Lovas"
  date="2002-07-14T10:24:02"
  subject="Re: [Caml-list] Five Questions about Objects">
</msg>
</msg>
</msg>
<msg 
  url="2002/07/8e7888e28c1b918c84298e36bdfb197e"
  from="Brian Smith &lt;blsmith@b...&gt;"
  author="Brian Smith"
  date="2002-07-20T12:56:50"
  subject="Re: [Caml-list] Five Questions about Objects">
<msg 
  url="2002/07/4a6d6ba66cbaf5fd1eb212e448adcbb0"
  from="YAMAGATA yoriyuki &lt;yoriyuki@m...&gt;"
  author="YAMAGATA yoriyuki"
  date="2002-07-20T15:49:38"
  subject="Re: [Caml-list] Five Questions about Objects">
</msg>
</msg>
</msg>
<msg 
  url="2002/07/75378d984912d08869be7863a3be88c1"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2002-07-14T03:32:58"
  subject="Re: [Caml-list] Five Questions about Objects">
</msg>
<msg 
  url="2002/07/f19d29f39c16d741976445296fba36ea"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-07-14T20:08:40"
  subject="Re: [Caml-list] Five Questions about Objects">
<msg 
  url="2002/07/2737a7cea2fd0851c3767abc9726e20b"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-16T04:48:45"
  subject="Re: [Caml-list] Five Questions about Objects">
</msg>
<msg 
  url="2002/07/f178655b06c3af22c50aee33163cd56f"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-16T04:48:07"
  subject="Re: [Caml-list] Five Questions about Objects">
</msg>
</msg>
</msg>
</thread>

<contents>
On Sunday 14 July 2002 11:47 am, Xavier Leroy wrote:
&gt; &gt; 2) What is the point of "class" and "new" keywords? How are they better
&gt; &gt; than "let" ? E.g.
&gt; &gt; 
&gt; &gt; let point a b =
&gt; &gt;   object
&gt; &gt;     val x = a
&gt; &gt;     val y = b
&gt; &gt;     method get () = (x, y)
&gt; &gt;   end;;
&gt; &gt; 
&gt; &gt; let my_point = point 3 7;;
&gt; &gt; let many_float_points = Array.make 100 (point 4.0 3.0);;
&gt; &gt; ?
&gt;
&gt; The main purpose of the class system is to support inheritance and
&gt; method overriding.  Object-oriented programming comes in two flavors:
&gt; class-based OOP, which is what all mainstream OO languages offer, and
&gt; delegation-based OOP, where there are no classes, objects are built
&gt; directly by listing their fields and methods like you suggested, and
&gt; method overriding is performed directly on objects, e.g. via a "copy
&gt; this object, replacing these methods" operation.  While there have
&gt; been some theoretical work on delegation-based OOP, I think it is fair
&gt; to say that it is less well understood than class-based OOP.

I thought my suggestion had to do with syntax only. One could still write 
things like 

type color = Red | Green | Blue

let pixel a b (c:color) = 
  object
    inherit point a b as p
    val col = c
    method get_color () = col
    method get_coords () = p#get ()
  end

I don't really see any significant "OO flavor" difference, just simpler and 
more consistent syntax IMHO: two keywords are eliminated, and class 
definition is now just function definition. If that is not the case, can you 
give examples in current O'Caml syntax that do not translate well into this 
"syntax" ?

Thanks
Oleg
-------------------
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>

