caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Chris Hecker <checker@d6.com>
To: caml-list@inria.fr
Subject: [Caml-list] float tuples as double_arrays?
Date: Fri, 27 Sep 2002 19:34:45 -0700	[thread overview]
Message-ID: <4.3.2.7.2.20020927192452.02e6b520@mail.d6.com> (raw)


The floats in an all-float tuple are boxed, unlike floats in all-float 
records.  The latter are treated as float arrays internally and have 
double_array_tag.  I'm wondering why the former aren't treated the same 
way?  Complexity in the compiler and not wanting the double_array special 
case code to metastasize more is a perfectly valid answer.

The only reason I ask is that the unboxed rep is more efficient, and tuples 
are more convenient for some things, like breaking things out with patterns:

let x,y,z = v in
(* use x y z here *)

while with an array you'd have

let [|x;y;z;|] = v in
(* this generates an incomplete match warning because the size isn't typed *)

or with a record

let {x=x;y=y;z=z;} = v in
(* need the module name on the field above if not opened, etc. *)

Chris

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


             reply	other threads:[~2002-09-28  2:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-28  2:34 Chris Hecker [this message]
2002-10-01  9:44 ` Xavier Leroy

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=4.3.2.7.2.20020927192452.02e6b520@mail.d6.com \
    --to=checker@d6.com \
    --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).