English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Re: polymorphic method.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-09-10 (12:35)
From: Guillaume Yziquel <guillaume.yziquel@c...>
Subject: Re: polymorphic method.

When developing with objects in OCaml, I'm quite often faced with 
polymorphic methods.

Such as:

class myobject = object
   method id x = x

Sometimes you have many methods that you're tinkling with, and the 
compiler keeps saying to you that 'a is inbound in this class declaration.

I'm therefore wondering if it would be a good idea to have a keyword 
'polymorphic', and one would write

class myobject = object
   polymorphic method id x = x

The polymorphic keyword would be a hint that the method is polymorphic 
and that there is no need to look at the class' type parameters.

      Guillaume Yziquel