Version française
Home     About     Download     Resources     Contact us    
Browse thread
Warning wished
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dmitri Boulytchev <db@t...>
Subject: Re: [Caml-list] Warning wished
    Hello Julien,

    no warning should be issued in this case since you have polymorphic 
function:
applying g to () you will definitely have f x of type unit :)
    Try another one:

    let f x = x+1
    let g x = f x; 1

    Now you'll get the warning since the compiler can ensure that type 
of  f x can never
be unit.

    Best regards,
    Dmitry.


> Hello,
>
> Is it a bug or a well-known feature that the above program does not emit
> a warning (because "f x" should have type unit in the body of "g") ?
>
> =====
> let f x = x
> let g x = f x; 1
> (* let _ = g 2 *)
> ====
>
> Best regards,
> Julien Signoles
>
> _______________________________________________
> 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
>
>