<?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/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"
  prev="2003/12/cb5267240922f26dddcd0cc2ff382f2b"
  next="2003/12/4ea2bc69089f80a24ff1562317bbfd41"
  prev-in-thread="2003/11/94ca042f44be533f27f5a8b42b4b788f"
  next-in-thread="2003/11/0e841f152ab8a939e37e43f48a0d5095"
  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>
[just now catching up with my caml mail; i left it accumulating unread 
for a couple months]

On 20 Nov 2003, at 05:07, Jacques Garrigue wrote:
&gt;
&gt; But in this process, I came along with the rather strange behaviour of
&gt; class variables. Class variables are defined by a let before any
&gt; parameters, for instance
&gt;   class c = let a = init () in fun ... -&gt; object ... end
&gt; Their current semantics is to be evaluated repeatedly, once for c,
&gt; but again for all classes inheriting from c. The problem is that this
&gt; is costly for the implementation, doesn't fit well with the
&gt; possibility to create dynamically an arbitrary number of classes
&gt; inheriting from, and that I don't see what it's intended for.
&gt;
&gt; So I'm planning to revert to the more intuitive semantics: evaluation
&gt; when creating c, but never again.
&gt;
&gt; Does that bother anybody?

The behavior you want to change is a behavior I noticed and it bothered 
me when I noticed it.  I just chalked it up to yet another weird thing 
about classes.  In order to get the behavior I wanted, I just lifted 
all my class variables out of the class definitions and used module 
signatures to hide them.

You want to make this change?  I'm supportive.  Please do.

One request I would make: please retain the functional object semantics 
and the {&lt; ... &gt;} syntax.  I used that feature with state monads and I 
like it a lot.


-- 
j h woodyatt &lt;jhw@wetware.com&gt;

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

