Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: malc <malc@p...>
Subject: Re: [Caml-list] partial application warning unreliable?
On Thu, 8 Dec 2005, Jacques Garrigue wrote:

<snip>
>
> # class cc = object (self)
>    method f x y = x + y
>    method g () = self#f 1;
>  end;;
> class cc :
>  object method f : int -> int -> int method g : unit -> int -> int end
>
> No warning, for the reason stated above: the semicolon does nothing.

Here's a strange test case, i was bitten by it recently in a real code:

<mox.ml>
let y o =
   o#moo;
   1

let x (o:(<moo : string -> unit>)) =
   y o

let _ =
   print_int (x (object method moo s = print_endline s end));
   print_newline ()
</mox.ml>

# ocaml -warn-error A mox.ml
1

In my case method moo was actually a method that locked a mutex, the
implications were quite severe.

-- 
mailto:malc@pulsesoft.com