Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: may be an other bug
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <xleroy@p...>
Subject: Re: may be an other bug

> 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