From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA06546; Thu, 20 Nov 2003 14:07:20 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA06589 for ; Thu, 20 Nov 2003 14:07:19 +0100 (MET) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hAKD7H104416 for ; Thu, 20 Nov 2003 14:07:17 +0100 (MET) Received: from localhost (suiren.kurims.kyoto-u.ac.jp [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.9.3p2-20030924/3.7W) with ESMTP id WAA19790 for ; Thu, 20 Nov 2003 22:07:15 +0900 (JST) To: caml-list@inria.fr Subject: [Caml-list] classes, objects, and class variables X-Mailer: Mew version 1.94.2 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20031120220714O.garrigue@kurims.kyoto-u.ac.jp> Date: Thu, 20 Nov 2003 22:07:14 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; jacques:01 dynamically:01 jacques:01 semantics:01 semantics:01 ocaml:01 garrigue:01 garrigue:01 behaviour:01 arbitrary:02 objects:02 objects:02 module:03 classes:03 classes:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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 ... -> 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