Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] float tuples as double_arrays?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-09-28 (02:34)
From: Chris Hecker <checker@d...>
Subject: [Caml-list] float tuples as double_arrays?

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. *)


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: