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 WAA05245; Sat, 5 Apr 2003 22:58:04 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 WAA05684 for ; Sat, 5 Apr 2003 22:58:02 +0200 (MET DST) Received: from mwinf0201.wanadoo.fr (smtp5.wanadoo.fr [193.252.22.29]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h35Kw2903612 for ; Sat, 5 Apr 2003 22:58:02 +0200 (MET DST) Received: from iliana (AStrasbourg-206-1-4-92.abo.wanadoo.fr [80.11.26.92]) by mwinf0201.wanadoo.fr (SMTP Server) with ESMTP id 24BAA300037A; Sat, 5 Apr 2003 22:58:02 +0200 (CEST) Received: from luther by iliana with local (Exim 3.36 #1 (Debian)) id 191ujh-0004ZQ-00; Sat, 05 Apr 2003 22:58:01 +0200 Date: Sat, 5 Apr 2003 22:58:01 +0200 To: sergey dyshel Cc: caml-list@inria.fr Subject: Re: [Caml-list] How can I simulate dynamic types in OCaml? Message-ID: <20030405205801.GA17522@iliana> References: <20030404115842.87369.qmail@web41213.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030404115842.87369.qmail@web41213.mail.yahoo.com> User-Agent: Mutt/1.5.4i From: Sven Luther X-Spam: no; 0.00; sven:01 luther:01 dpt-info:01 u-strasbg:01 caml-list:01 sergey:99 ocaml:01 variants:01 checking:01 variant:02 04,:03 wrote:03 dynamic:03 types:03 0800,:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, Apr 04, 2003 at 03:58:42AM -0800, sergey dyshel wrote: > Hi > > I like static type-checking in OCaml but sometimes I > need to implement some dynamic stuff (like a list of > values of different types). Is there a way to > do it in OCaml or at least simulate this? Use a list of variants ? type element = A of a | B of b | C of c | D of d | ... type liste = element list You have to check the appropriate variant each time (or most time) you use it, but after all, you wanted dynamic type checking. Friendly, Sven Luther ------------------- 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