Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Gripes with array
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@j...>
Subject: [Caml-list] Gripes with array

I'm increasingly finding the outrageously finite size limit of arrays to be a 
pain. In particular, I'm peeved that the size limit is itself a function of 
the type which, therefore, makes writing polymorphic functions over arrays 
nay-on impossible (e.g. to make an array of maximum-sized arrays). Can 
anything be done about this? Am I right in thinking that the maximum 
non-float array size on a 64-bit machine is 18,014,398,509,481,983?

Also, can Array.init be made to fill the elements only once? This would make 
quite a few things twice as fast (Indeed, I'd always assumed that this was 
the point of having Array.init, having read some of Skaller's previous 
ramblings ;-). Array.copy could then be written more succinctly and 
efficiently in terms of Array.init as:

let copy a = init (length a) (fun i -> a.(i))

Does anyone have any pointers to information about the origin of the size 
limit for arrays? I assume it is something to do with the garbage collector 
using a fixed-size tag instead of a variable-size one but I'd be interested 
in the details.

Cheers,
Jon.

-------------------
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