caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Leo White <leo@lpw25.net>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Data representation of records
Date: Tue, 19 Jan 2016 04:07:49 -0500	[thread overview]
Message-ID: <1453194469.2351553.496126650.44E1CE9C@webmail.messagingengine.com> (raw)
In-Reply-To: <CALahJKBRxsNvz4dcd+KSuZFSMhoJeOauXAbyNEEad+cjr72DDg@mail.gmail.com>

> My question is, why records need the labels.
> In my comprehension, there is no chance that we check the label of records.

The "label" is called the tag. Every allocated object in OCaml has a tag. They are stored in the header word and are part of the information used by the GC to traverse OCaml values (they are also used by the non-parametric polymorphic functions like "=" and "Hashtbl.hash"). Tags above a certain number have special meaning for the GC, all the rest are used for ordinary values (records, variants etc.). Records have to be given one of these ordinary tags so it might as well be 0.

Regards,

Leo

      reply	other threads:[~2016-01-19  9:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-19  8:54 Ryohei Tokuda
2016-01-19  9:07 ` Leo White [this message]

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=1453194469.2351553.496126650.44E1CE9C@webmail.messagingengine.com \
    --to=leo@lpw25.net \
    --cc=caml-list@inria.fr \
    /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).