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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: david.mentre@w...
Subject: Re: [Caml-list] Array.make
Ian Zimmerman <itz@speakeasy.org> writes:

> raises an exception when n = 0.  Why?  It looks like an unnecessary
> special case.  The damned hysterical raisins again?

Was a bug in the doc. Fixed in latest release (3.04):

val make : int -> 'a -> 'a array
[...]
Raise Invalid_argument if n < 0 or n > Sys.max_array_length.



> BTW, the documentation also doesn't say how Array.init behaves in this
> respect. 

Same behavior as Array.make (ok, maybe it should be in the doc). BTW, it
seems that check is made using same code as Array.make (haven't look at
the code):

# Array.init 0 (fun x -> 0) ;;
- : int array = [||]
# Array.init (-1) (fun x -> 0) ;;
Exception: Invalid_argument "Array.make".

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr