Le mardi 05 juillet 2011 à 15:18 +0100, Wojciech Meyer a écrit :
> The unused binding j is not taken account and thrown away, so the type
> system will not take into account + operator that will cause i to be int.
> Why the unused binding is being thrown away before type checker, I don't
> know, maybe somebody could explain possibly.

This is not the reason for the acceptance of this input because the
following also typecheck (in 3.12.0):

  let f ic = 
    let i = input_value ic in
    let j = i + 1 in
    (j, i, LargeFile.seek_in ic i);

with (apparently wrong) type:

  val f : in_channel -> int * 'a * unit = <fun>

This looks like a bug in the type checker.

A smaller triggering program is: 

  let f () = 
    let i = input_value stdin in
    let j = i + 1 in
    i, j;;

Mathias




-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to