From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA25374 for caml-redistribution; Tue, 11 Jan 2000 18:31:04 +0100 (MET) 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 SAA03163 for ; Tue, 11 Jan 2000 18:24:15 +0100 (MET) Received: from miss.wu-wien.ac.at (miss.wu-wien.ac.at [137.208.107.17]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id SAA05368 for ; Tue, 11 Jan 2000 18:24:13 +0100 (MET) Received: (from mottl@localhost) by miss.wu-wien.ac.at (8.9.0/8.9.0) id SAA11915; Tue, 11 Jan 2000 18:23:58 +0100 (MET) From: Markus Mottl Message-Id: <200001111723.SAA11915@miss.wu-wien.ac.at> Subject: Re: ocamlyacc and polymorphic variants To: tews@tcs.inf.tu-dresden.de (Hendrik Tews) Date: Tue, 11 Jan 2000 18:23:58 +0100 (MET) Cc: caml-list@inria.fr (OCAML) In-Reply-To: <200001110852.JAA16936@ithif20.inf.tu-dresden.de> from "Hendrik Tews" at Jan 11, 0 09:52:23 am X-Mailer: ELM [version 2.4 PL21] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: weis > The internal representation does only depend on the name of the > constructor. This is described in one of Jacques Garrigues papers > about Olabl. In particular you find, that variant tags `C00J10 > and `N60r0 have the same internal representation, so you can't > use both of them in one program. (This was at least the case > olabl 2.02, I haven't checked it with ocaml 2.99.) Thanks for the explanation - now this really helps in understanding how the internal representation looks like. I have just tried this with OCaml 2.99 - here the result: # `C00J10 = `N60r0;; In this program, variant constructors `C00J10 and `N60r0 have same hash value. Interesting: so the internal representation of tags for polymorphic variants is just the hash value of their names! Luckily, the system seems to check whether two different names accidently have the same hash value... (though it is probably very unlikely that two hash values of "normal" names clash). I guess that this is always safe since all the polymorphic variants appear in the type, which makes it always unambiguous how to interpret values. Best regards, Markus Mottl -- Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl