Version franÁaise
Home ††† About ††† Download ††† Resources ††† Contact us †††
Browse thread
value restriction
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Kaustuv Chaudhuri <kaustuv.chaudhuri@i...>
Subject: Re: [Caml-list] Re: value restriction
On Sat, Jan 2, 2010 at 5:46 PM, Andrej Bauer <andrej.bauer@andrej.com> wrote:
> It's even worse:
>        Objective Caml version 3.11.1
> # let _ = ref () in fun x -> x ;;
> - : '_a -> '_a = <fun>
> I am sure this makes sense in France.

I'm not sure why you're singling out France.

% sml
Standard ML of New Jersey v110.69 [built: Sun Jun  7 19:18:24 2009]
- let val _ = ref () in fn x => x end ;
stdIn:1.1-1.36 Warning: type vars not generalized because of
   value restriction are instantiated to dummy types (X1,X2,...)
val it = fn : ?.X1 -> ?.X1

This shouldn't be surprising: a let form is "expansive" and therefore
cannot have a polymorphic type. OCaml is much more liberal than SML
about what forms it considers "non-expansive" [1].

-- Kaustuv

[1] http://caml.inria.fr/pub/papers/garrigue-value_restriction-fiwflp04.pdf