Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Polymorphic methods and ellipsis
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alessandro Baretta <alex@b...>
Subject: [Caml-list] Polymorphic methods and ellipsis
I'm trying to write a polymorphic method that will accept as 
a parameter any instance of any subclass of given class. For 

class parent = object
   method foo = "Hello "
   method bar = "World!"

class son = object
   inherit parent
   method buz = "Cheers"

class salutation : object
   method greet : 'a. (#parent as 'a) -> string
end = object
   method greet obj = obj # foo ^ obj # bar

But of course, this does not work. What is problem? How can 
I get a method with a polymorphic ellipsis in its type?


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: