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 DAA31253; Sat, 21 Aug 2004 03:57:22 +0200 (MET DST) 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 DAA31008 for ; Sat, 21 Aug 2004 03:57:20 +0200 (MET DST) Received: from relaissmtp.ens-lyon.fr (pluvier.ens-lyon.fr [140.77.167.5]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i7L1vKRM016286 for ; Sat, 21 Aug 2004 03:57:20 +0200 Received: from mouette.ens-lyon.fr ([140.77.167.4]) by relaissmtp.ens-lyon.fr with esmtp (Exim 3.35 #1 (Debian)) id 1ByL8B-0006q7-00 for ; Sat, 21 Aug 2004 03:57:19 +0200 Received: by mouette.ens-lyon.fr (Postfix, from userid 33) id 8399A3C61C2; Sat, 21 Aug 2004 03:57:19 +0200 (CEST) To: caml-list Subject: [Caml-list] Programming with classes Message-ID: <1093053438.4126abfecddbe@mouette.ens-lyon.fr> Date: Sat, 21 Aug 2004 03:57:18 +0200 (CEST) From: Jean-Baptiste Rouquier References: <1093051727.29139.1503.camel@pelican.wigram> In-Reply-To: <1093051727.29139.1503.camel@pelican.wigram> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: IMP/PHP IMAP webmail program 2.2.6 X-Originating-IP: 68.40.185.95 X-Miltered: at concorde with ID 4126AC00.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 ens-lyon:01 quoting:01 foo:01 foo:01 wrappers:01 stub:01 ocaml:01 int:01 int:01 polymorphic:01 constructors:01 constructors:01 float:02 float:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Quoting skaller: >There is a further step: constructors. Never export >class constructors. They must be wrapped in a normal >Ocaml function which returns an abstract class type. I would be glad to follow this rule, since I'm experiencing aesthetical problems with constructors (see below). But could you develop a bit on this ? My problem is that I'm exporting many class constructors (if you explain me why I shouldnt, the next version probably won't) with similar argument types : class type ['a] foo = object ... end class foo_int : int -> string -> [int] foo class foo_float : float -> string -> [float] foo class ['a] foo_option : 'a wrappers -> 'a option -> string -> ['a option] foo ... The actual class constructors have more arguments, so I'd like to define a sort of polymorphic class specification and then avoid to repeat the arguments. The aim is to have clearer documentation. I was considering wrapping it all into functions but it's pure stub code. Suggestions ? Thanks, -- Jean-Baptiste Rouquier ------------------- 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