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
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list] Polymorphic methods
From: Alain Frisch <>

> is there any plan to add polymorphic methods to OCaml ?  The more I use
> objects, the more I miss this feature. There is a poly_meth branch in
> the CVS, but it does not seem really active nowadays ...

After two years, my promises may seem void, but I intend to implement
polymorphic methods, probably as soon as 3.03 is released.
Or should I start before?
This is a rather large chunk of work, modifying very sensitive parts
of the compiler...

What would you need them for? One reason I was not so eager to start
working on them is that they do not solve all problems of
polymorphism. For instance, you cannot define a map method, even with
polymorphic methods.

> Did OLabl raise some practical problems with polymorphic methods ?

There was a problem of compilation speed. I have now a few ideas of
how to improve it, but this may still mean that the change would only
be provided as a patch.

Another problem is that such methods cannot be inferred. As a result
you can have strange type errors, because you used a method before
knowing its actual type. In OLabl there was a warning every time you
used a method whose type was unkwown, but I have been told it was not
very Caml-like.

Jacques Garrigue
Bug reports:  FAQ:
To unsubscribe, mail  Archives: