caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Martin Jambon <martin.jambon@ens-lyon.org>
To: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Unboxed float tuples
Date: Sun, 08 Nov 2009 18:29:17 +0100	[thread overview]
Message-ID: <4AF6FFED.2060900@ens-lyon.org> (raw)
In-Reply-To: <91a3da520911080801w6637b652w94a717a830b1c5bd@mail.gmail.com>

Daniel Bünzli wrote:
> Tuples and records are represented the same way. However when it comes
> to records with only floats fields we get a special unboxed
> representation.
> 
> Why don't we get that for tuples of floats only ?

Because polymorphic functions like fst would break (or would require extra
runtime checking).

Note that ('a * 'b) is pretty much the same as:
type ('a, 'b) tuple = { a : 'a; b : 'b }


# Obj.tag (Obj.repr { a = 1.0; b = 1.0 });;
- : int = 0
# Obj.tag (Obj.repr (1.0, 1.0));;
- : int = 0


whereas:

# Obj.tag (Obj.repr { Complex.re = 1.0; im = 1.0 });;
- : int = 254



Martin

-- 
http://mjambon.com/


  parent reply	other threads:[~2009-11-08 17:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-08 16:01 Daniel Bünzli
2009-11-08 16:46 ` [Caml-list] " Jon Harrop
2009-11-08 17:29 ` Martin Jambon [this message]
2009-11-08 19:39 ` Brian Hurt
2009-11-08 20:36   ` Jon Harrop
2009-11-08 20:09 ` Richard Jones
2009-11-08 20:58   ` Christophe Raffalli
2009-11-08 21:25     ` Lukasz Stafiniak

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=4AF6FFED.2060900@ens-lyon.org \
    --to=martin.jambon@ens-lyon.org \
    --cc=caml-list@inria.fr \
    --cc=daniel.buenzli@erratique.ch \
    /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).