Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Duplicate methods - bug or feature?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Paul Stodghill <stodghil@c...>
Subject: [Caml-list] Duplicate methods - bug or feature?
Is it a bug or feature that a class can contain two methods with the
same name? Thanks.

milhouse$ uname -a
CYGWIN_NT-5.0 MILHOUSE 1.3.2(0.39/3/2) 2001-05-20 23:28 i686 unknown
milhouse$ ocamlc -v
The Objective Caml compiler, version 3.02
Standard library directory: /usr/local/lib/ocaml
milhouse$ 
milhouse$ 
milhouse$ cat double_method.ml 
class a =
object
  method m = "a.m1"
  method m = "a.m2"
end
;;

let _ =
  let x = new a in
    Printf.printf "x=%s\n" x#m;
    ()
;;

milhouse$ 
milhouse$ 
milhouse$ ocamlc -o double_method.exe double_method.ml 
milhouse$ ./double_method.exe 
x=a.m2
milhouse$ 

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr