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
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: 2009-10-27 (09:04)
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)

     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

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?

~Brighten Godfrey