Re: may be an other bug

Xavier Leroy (xleroy@pauillac.inria.fr)
Fri, 16 Feb 1996 14:57:20 +0100 (MET)

From: Xavier Leroy <xleroy@pauillac.inria.fr>
Message-Id: <199602161357.OAA17569@pauillac.inria.fr>
Subject: Re: may be an other bug
To: delapla@lami.univ-evry.fr (Franck Delaplace)
Date: Fri, 16 Feb 1996 14:57:20 +0100 (MET)
In-Reply-To: <199602151419.PAA10563@berlioz.lami.univ-evry.fr> from "Franck Delaplace" at Feb 15, 96 03:19:25 pm

> I built a script shell to add signature to .mli
> as follow
>
> When I use it for global variabale as hash table
> the signature is
>
> let L = hashtbl__new 30 ;;
>
> L : hashtbl__t _a
>
> instead of the real instantion of L
>

The -i option to camlc prints the inferred types immediately after it
has been inferred. If the type is not generic, it may get instantiated
during the typing of the remainder of the file. E.g. :

let L = hashtbl__new 30 ;;

inferred type L: ('_a, '_b) hashtbl__t
with '_a and '_b not generic

hashtbl__add L 123 "hello" ;;
'_a becomes int
'_b becomes string
L has type (int, string) hashtbl__t

The alternative, which is used in Caml Special Light, is to print the
types only at the end of the typing phase. Then, the types printed are
correct. But another user complained that if a type error occurs, no
types are printed...

- Xavier Leroy