caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* generic functions
@ 2005-01-09 13:19 wiedergaenger
  2005-01-09 14:56 ` [Caml-list] " Richard Jones
  2005-01-09 15:48 ` Brian Hurt
  0 siblings, 2 replies; 12+ messages in thread
From: wiedergaenger @ 2005-01-09 13:19 UTC (permalink / raw)
  To: caml-list

I just got from LISP to OCaml, and wondered if there is an equivalent of
generic functions from LISP (CLOS) in OCaml. In the Common Lisp Object
System methods don't belong to certain objects/classes. They are just
function specializing on the argument types. So basically I want to
write something like:

let foo (x : int) = x*x;;
let foo (x : float) = x*.x;;

This, obviously, will not work since foo is just redefined by the second
statement. One would think, that having methods not being belonging to
objects/classes, is rather pointless. Well 95% of the time, there is no
necessity for that. But in the other 5%, it is really helpful. 


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

end of thread, other threads:[~2005-01-12 23:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-09 13:19 generic functions wiedergaenger
2005-01-09 14:56 ` [Caml-list] " Richard Jones
2005-01-09 15:48 ` Brian Hurt
2005-01-09 17:17   ` David McClain
2005-01-09 18:09     ` brogoff
2005-01-09 18:45   ` padiolea
2005-01-10  0:23   ` skaller
2005-01-11 12:14     ` Daniel Yokomizo
2005-01-10  9:55   ` [Caml-list] " Alex Baretta
2005-01-10 10:47     ` Olivier Andrieu
2005-01-10 12:16       ` Alex Baretta
2005-01-12 23:49     ` Aleksey Nogin

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