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 RAA15296 for caml-redistribution; Tue, 1 Jun 1999 17:18:45 +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 QAA05282 for ; Mon, 31 May 1999 16:22:38 +0200 (MET DST) Received: from pcmath65.unice.fr (pcmath65.unice.fr [134.59.10.65]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id QAA00160 for ; Mon, 31 May 1999 16:22:37 +0200 (MET DST) Received: from math.unice.fr (vyskocil@localhost [127.0.0.1]) by pcmath65.unice.fr (8.8.7/8.8.7) with ESMTP id QAA09457 for ; Mon, 31 May 1999 16:20:41 +0200 Sender: weis Message-ID: <37529AB8.B306AD5F@math.unice.fr> Date: Mon, 31 May 1999 16:20:40 +0200 From: Vyskocil Vladimir Organization: UNSA X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.0.36 i686) X-Accept-Language: fr-FR MIME-Version: 1.0 To: Caml list Subject: Constante NIL Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Bonjour, N'est t'il pas concevable de rajouter a Objectif Caml une constante NIL, UNDEF ou je sais pas trop comment la nommer dont la valeur serait '_a. Ceci permettrait d'initialiser "par defaut", par exemples, les variables d'instances d'une classe lorsque l'on ne possede aucune valeur par defaut du bon type. Je sais qu'il y'a toujours la possibilite d'utiliser le type 'a option mais ca devient lourd a gerer... Comme pour le type "special" '_a, la variable d'instance prendrait le bon type des qu'il est connu. J'utilise actuellement CamlTk encapsulé par des classes et cette situation se presente frequement, par exemple (en simpifié) : class toplevel parent = object end ;; class bouton parent = object end ;; class boite parent = let win = new toplevel parent in object (self) inherit toplevel parent method get_win = win end ;; class ma_boite parent = object (self) inherit boite parent as super val mutable bt = ??? (* <- que mettre ici ? *) initializer (* ici l'objet est initialise donc on peut recuperer le parent *) bt = new bouton super#get_win end ;; -- Vyskocil Vladimir vyskocil@math.unice.fr http://pcmath65.unice.fr/~vyskocil http://www.inria.fr/safir/WHOSWHO/Vladimir.html