Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: arrays and type variables...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <Pierre.Weis@i...>
Subject: Re: arrays and type variables...
> Shouldn't "[| [] |]" count as a value??
> 
> bash$ ocaml
>         Objective Caml version 2.00
> 
> # let x = [| [] |];;
> val x : '_a list array = [|[]|]
[...]
> Cheers,
> Don

No, we can't, since it is equivalent to create a polymorphic reference
(you just have to put the value into a list and to assign this list to
the vector). This would break the type system's safety theorem: it
would lead to ``bus errors''.

Best regards,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://cristal.inria.fr/~weis/