caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <mottl@miss.wu-wien.ac.at>
To: tews@tcs.inf.tu-dresden.de (Hendrik Tews)
Cc: caml-list@inria.fr (OCAML)
Subject: Re: ocamlyacc and polymorphic variants
Date: Tue, 11 Jan 2000 18:23:58 +0100 (MET)	[thread overview]
Message-ID: <200001111723.SAA11915@miss.wu-wien.ac.at> (raw)
In-Reply-To: <200001110852.JAA16936@ithif20.inf.tu-dresden.de> from "Hendrik Tews" at Jan 11, 0 09:52:23 am

> 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




       reply	other threads:[~2000-01-11 17:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200001110852.JAA16936@ithif20.inf.tu-dresden.de>
2000-01-11 17:23 ` Markus Mottl [this message]
2000-01-08 18:14 Markus Mottl
2000-01-11 10:03 ` Jacques Garrigue
2000-01-11 15:59   ` Markus Mottl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200001111723.SAA11915@miss.wu-wien.ac.at \
    --to=mottl@miss.wu-wien.ac.at \
    --cc=caml-list@inria.fr \
    --cc=tews@tcs.inf.tu-dresden.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).