Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Warning: explanation needed
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Prevost <j.prevost@c...>
Subject: Re: [Caml-list] Warning: explanation needed
>>>>> "ab" == Alessandro Baretta <alex@baretta.com> writes:

    ab> I'm not sure I get what this means. The following is my
    ab> guess. Please, correct me if I'm wrong.

    ab> In a class with multiple inheritance, the method mentioned in
    ab> the warning is defined by multiple parent classes. Hence, the
    ab> last class from which set_sub_node_context is inherited
    ab> overrides the previously inherited definition.

Actually, it's more general.  If there's a pre-existing definition of
the method at all, a warning is given.  So:

class a =
  object
    method m = 1
  end

class b =
  object
    method m = 2
  end

class c =
  object
    method m = 3
    inherit b
  end

class d =
  object
    inherit a
    inherit b
  end

class e =
  object
    inherit b
    method m = 3
  end

You get the warning for classes c and d, but not for class e.

John.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners