caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Polymorphic methods and ellipsis
@ 2002-09-21  0:26 Alessandro Baretta
  2002-09-21  0:31 ` Pixel
  0 siblings, 1 reply; 7+ messages in thread
From: Alessandro Baretta @ 2002-09-21  0:26 UTC (permalink / raw)
  To: Ocaml; +Cc: Jacques Garrigue

I'm trying to write a polymorphic method that will accept as 
a parameter any instance of any subclass of given class. For 
example

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

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

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


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

Alex

-------------------
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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-09-24  8:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-21  0:26 [Caml-list] Polymorphic methods and ellipsis Alessandro Baretta
2002-09-21  0:31 ` Pixel
2002-09-21  8:35   ` Alessandro Baretta
2002-09-22  9:07     ` Jacques Garrigue
2002-09-22  9:39       ` Alessandro Baretta
2002-09-22 17:09         ` brogoff
2002-09-24  9:04           ` Alessandro Baretta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).