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 PAA17599; Thu, 4 Apr 2002 15:03:27 +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 PAA18774 for ; Thu, 4 Apr 2002 15:03:26 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from mel-rto6.wanadoo.fr (smtp-out-6.wanadoo.fr [193.252.19.25]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g34D3PD16801 for ; Thu, 4 Apr 2002 15:03:25 +0200 (MET DST) Received: from mel-rta6.wanadoo.fr (193.252.19.222) by mel-rto6.wanadoo.fr; 4 Apr 2002 15:03:25 +0200 Received: from debian (80.8.76.214) by mel-rta6.wanadoo.fr; 4 Apr 2002 15:03:15 +0200 Received: from moi by debian with local (Exim 3.35 #1 (Debian)) id 16t5yS-0001Yp-00 for ; Thu, 04 Apr 2002 14:04:16 +0200 To: caml-list@inria.fr Subject: Re: [Caml-list] Type variables won't generalize References: From: Remi VANICAT Date: 04 Apr 2002 14:04:16 +0200 In-Reply-To: Message-ID: <87lmc3isan.dlv@wanadoo.fr> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk "Ryan Tarpine" writes: > Thank you; that was the explanation I was waiting for! My next > question is whether or not there is some non-typesafe route around > this. Could I use Obj.magic to store different data types in one > field, as long as I keep track of what type is really there (e.g., > have a second field that would store a number representing the type) > so I can cast back later? Sorry if I keep finding myself longing for > the "void*" C-ism! well, I don't really see the interest of such things. If you already know the types you can put in this field, you can use a new variant type : type multi = | Float of float | Int of int | Int2float of int -> float .... otherwise, it seem (to me) that you may find better way of doing it that using a "void*" C-ism. -- Rémi Vanicat vanicat@labri.u-bordeaux.fr http://dept-info.labri.u-bordeaux.fr/~vanicat ------------------- 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