on another note (but staying very much on the same topic), why won't the
following generalize:

# let foo =
    let counter  = ref 0 in
    let bar = !counter  in
    let baz = fun x -> bar
    in
      baz


val foo : '_a -> int = <fun>


baz clearly has a polymorphic type, yet foo doesn't.
Is there any way around this ?

--Jacques L.

On Fri, Jan 1, 2010 at 6:05 PM, Jacques Le Normand <rathere...@gmail.com>wrote:

> Hello caml-list,
> with respect to the value restriction, what exactly constitutes a value?
> the textbook definition doesn't seem to hold, since the following
> generalizes:
>
> let f = let x = 1 in fun g h x -> g (h x);;
>
> while this won't:
>
> let f () = let x = (fun x -> x) (fun x -> x) in fun g h x -> g (h x);;
>
> cheers
>
> --Jacques L.
>
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to