Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
partial application warning unreliable?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-12-10 (00:49)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] partial application warning unreliable?
From: malc <>

> I gather all this means that the only "safe" way to call a unit method
> on an implictily typed object is via:
> let () = o#moo in ...

Yes, but only if the type of o is unknown.
If o itself was defined by a let statement, or there was a type
  let f (o : c) = ...
then the warnings will work properly (fortunately.)

Personally, I annotate almost all objects received as function
arguments. It may be seen as defeating the purpose of type inference, but
this produces better error messages, and avoids the above problem.
It is also necessary with polymorphic methods or optional arguments.

Jacques Garrigue