<?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="2003/11/94ca042f44be533f27f5a8b42b4b788f"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2003-11-20T13:07:20"
  subject="[Caml-list] classes, objects, and class variables"
  prev="2003/11/7754c236d20361023d8ba46436616c14"
  next="2003/11/94da893a26988f2c2ceff426e78c73d9"
  next-in-thread="2003/12/78f379d2c9642d4987dc5690a39dbaa7"
  prev-thread="2003/11/94d3362b05f025d593538a0c9478ebd5"
  next-thread="2003/11/81eb4f0d376b6f9e176101051e0c06b2"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] classes, objects, and class variables">
<msg 
  url="2003/11/94ca042f44be533f27f5a8b42b4b788f"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2003-11-20T13:07:20"
  subject="[Caml-list] classes, objects, and class variables">
<msg 
  url="2003/12/78f379d2c9642d4987dc5690a39dbaa7"
  from="james woodyatt &lt;jhw@w...&gt;"
  author="james woodyatt"
  date="2003-12-23T07:38:12"
  subject="Re: [Caml-list] classes, objects, and class variables">
</msg>
<msg 
  url="2003/11/0e841f152ab8a939e37e43f48a0d5095"
  from="Gerd Stolpmann &lt;info@g...&gt;"
  author="Gerd Stolpmann"
  date="2003-11-20T15:53:35"
  subject="Re: [Caml-list] classes, objects, and class variables">
</msg>
</msg>
</thread>

<contents>
To whom it may concern,

I'm in the process of improving the ocaml class system.
Principally the following two points:
1) making class creation cheaper.
   If you believed you could create classes in a "let module", and
   get away with it, you weere: it was prohibitively expensive in both
   time and space. Now I'm seeing 10000% speeups.
2) using this to make objects (or final classes) first class.
   Be able to write "let o = object (self) method m = ... end"
   Side advantage, there are no restrictions on polymorphism.

But in this process, I came along with the rather strange behaviour of
class variables. Class variables are defined by a let before any
parameters, for instance
  class c = let a = init () in fun ... -&gt; object ... end
Their current semantics is to be evaluated repeatedly, once for c,
but again for all classes inheriting from c. The problem is that this
is costly for the implementation, doesn't fit well with the
possibility to create dynamically an arbitrary number of classes
inheriting from, and that I don't see what it's intended for.

So I'm planning to revert to the more intuitive semantics: evaluation
when creating c, but never again.

Does that bother anybody?

Jacques Garrigue

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

