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 MAA19780; Mon, 11 Feb 2002 12:47:58 +0100 (MET) 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 MAA18023 for ; Mon, 11 Feb 2002 12:47:57 +0100 (MET) Received: from mel-rto4.wanadoo.fr (smtp-out-4.wanadoo.fr [193.252.19.23]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g1BBlvb09125 for ; Mon, 11 Feb 2002 12:47:57 +0100 (MET) Received: from mel-rta1.wanadoo.fr (193.252.19.150) by mel-rto4.wanadoo.fr; 11 Feb 2002 12:47:56 +0100 Received: from debian (80.8.75.196) by mel-rta1.wanadoo.fr; 11 Feb 2002 12:47:43 +0100 Received: from moi by debian with local (Exim 3.34 #1 (Debian)) id 16aEwH-0000lo-00 for ; Mon, 11 Feb 2002 12:48:05 +0100 To: caml-list@inria.fr Subject: Re: [Caml-list] Allowing many types References: <20020211105306.GC11294@mandelbrot.house> From: Remi VANICAT Date: 11 Feb 2002 12:48:05 +0100 In-Reply-To: <20020211105306.GC11294@mandelbrot.house> Message-ID: <87u1soz1ca.dlv@wanadoo.fr> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 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 Ceri Storey writes: > On Sun, Feb 10, 2002 at 08:43:20PM -0500, Ryan Tarpine wrote: > > Is there a type that means "any polymorphic variant"? Trying to set > > type primitive = [ `PTest ] > > forces only `PTest to be the value of object_data. How can I allow > > anything to be stored there? > > According to the output of the toplevel, then the type [> `Foo | `Bar ] > should be usable, but alas, it is not allowable in type specifictions, > giving "Unbound type parameter [..]". > > I've also tried just using plain tuples for this, but then lots of types > become ungeneralisable, eg in the trivial example: > # List.map (fun x -> x) [`X; `Y; `Z];; > - : _[> `X | `Y | `Z] list = [`X; `Y; `Z] > > So say, declaring such a variable in a complied module is impossible > (AFAIK). there is a hidden type variable : type 'a t = 'a constraint 'a = [> `Foo | `Bar ] work... -- Rémi Vanicat vanicat@labri.u-bordeaux.fr http://dept-info.labri.u-bordeaux.fr/~vanicat ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr