From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA12339 for caml-redistribution; Fri, 25 Jul 1997 11:39:14 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA11842 for ; Fri, 25 Jul 1997 11:09:21 +0200 (MET DST) Received: from batman.labri.u-bordeaux.fr (batman.labri.u-bordeaux.fr [147.210.8.5]) by nez-perce.inria.fr (8.8.5/8.8.5) with ESMTP id LAA10943 for ; Fri, 25 Jul 1997 11:09:18 +0200 (MET DST) Received: from scrasmeustache.labri.u-bordeaux.fr (scrasmeustache [147.210.8.85]) by batman.labri.u-bordeaux.fr (8.7.5/8.7.3) with ESMTP id KAA21238 for ; Fri, 25 Jul 1997 10:58:48 +0200 (MET DST) Received: from scrasmeustache (localhost [127.0.0.1]) by scrasmeustache.labri.u-bordeaux.fr (8.7.5/8.7.3) with SMTP id LAA07348 for ; Fri, 25 Jul 1997 11:09:05 +0200 (MET DST) Message-ID: <33D86D30.5889@labri.u-bordeaux.fr> Date: Fri, 25 Jul 1997 11:09:04 +0200 From: Pierre CASTERAN Organization: LaBRI X-Mailer: Mozilla 3.0Gold (X11; I; SunOS 5.5 sun4m) MIME-Version: 1.0 To: caml-list@inria.fr Subject: about "new" Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: weis Hello, I'm a beginner in Objective Caml, but not in ML; my question is about object building : Is there any way to define a class with some initializing function, which is to be called each time an instance is created by a "new" ; the interest would be of course to create a "consistent" state for a newly created object. Similarly, is it possible to attach a function to a class, which would be called before the creation of an instance ? it would be useful to check some preconditions to the creation of an instance. we can imagine that, if that function returns false, an exception is raised and the instance is not created. -- Pierre Casteran, LaBRI, Universite Bordeaux-I | 12 place Puy Paulin 351 Cours de la Liberation | 33000 Bordeaux F-33405 TALENCE Cedex | France France | (+ 33) 5 56 81 15 80 tel : (+ 33) 5 56 84 69 31 fax : (+ 33) 5 56 84 66 69 email: casteran@labri.u-bordeaux.fr www: http://dept-info.labri.u-bordeaux.fr/~casteran "Les rêves sont aussi beaux que la réalité, mais ils ne sont pas mieux". ( J.L.Borges )