English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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 (01:40)
From: malc <malc@p...>
Subject: Re: [Caml-list] partial application warning unreliable?
On Sat, 10 Dec 2005, Jacques Garrigue wrote:

> From: malc <malc@pulsesoft.com>
>> 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
> annotation
>  let f (o : c) = ...
> then the warnings will work properly (fortunately.)

I haven't done that because in my particular case that would have
required recursive modules (and not inside the same source unit).
And having two set of class types that described type of o didn't
really appeal to me all that much.

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