Version française
Home     About     Download     Resources     Contact us    
Browse thread
Ocaml 3.09.3 --> 3.11.0 breaks this
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brighten Godfrey <pbg@i...>
Subject: Ocaml 3.09.3 --> 3.11.0 breaks this
Hello list,

I went to recompile some software I wrote, after installing OCaml  
3.11.0, and it won't compile.  Specifically the following code snippet  
compiles in OCaml 3.09.3:

     class virtual c1 = object(self)
         end

     class virtual c2 = object(self)
         inherit c1

         method virtual stuff: c2 list

         method contents: c1 list =
             (self#stuff :> c1 list)

         method size: int =
              List.fold_right (fun (c:c2) sum ->
                 (c#size) + sum) (self#stuff) 0
         end

Yet in 3.11.0, the compiler complains:

     File "test.ml", line 14, characters 10-11:
     Error: This expression has type c2
            It has no method size

The expression in question is the variable `c' in the expression  
`c#size'.  Note that removing the method `contents', which is not used  
anywhere, or having `contents' just return [], causes it to compile  
without error.

Any thoughts?

Thanks,
~Brighten Godfrey