Jacques Garrigue recently implemented a patch that tries to keep user-provided
type names when printing out types, and also when giving error
messages. In your
example, there probably is an internal variable that's called "a" because of the
type name you provided. Some wizardry happens with GADTs, so another type
variable is generated. The other one ends up being printed, and because it's
called "a" too, the type-checker has to find another suitable name.

Or something like that. Maybe change type a b. to type foo bar. will give
different results :).

This is an explanation of why it is printed so.

The question of Roberto is rather whether this is intended or should be
fixed (call it a bug or anything else).

If the intention is that types should be printed with _best_ variable names
for some meaning of best (shortest, reuse source variable names whenever
meaningful, etc.), I do not see any reasonable definition of "best" that
would imply printing 'a1 in Roberto's example instead of 'a, while 'a is
printed in the two following examples (especially the second one) while
it appears in the source---and also unified with int in the second example.

        let id : 'a -> 'b = function x -> 1
        id : 'a -> 'a

        let foo : 'b -> 'a = function x -> fst x; 1;;
        val foo : 'a * 'b -> int = <fun>

Thus, I would tend to call this a bug (a something that should be fixed if
possible)...

        Didier



--
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