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
Feature wish: to omit explicit coercion for mli's
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-11-21 (12:55)
From: Keiko Nakata <keiko@k...>
Subject: Re: [Caml-list] Feature wish: to omit explicit coercion for mli's
From: Oliver Bandel <oliver@first.in-berlin.de>
> If *.ml and *.mli do not match, then you have written
> code that better would be rewritten, to say it nicely. ;-)

I do not think this is a bug-wish.

ob.ml would match with ob.mli by inserting explicit coercion as in :

in ob.ml: 
 let o = (object  method f1 = 1  method f2 = 2 end :> < f1 : int >)

in ob.mli:
 val o : < f1 : int >

I thought that this explicit coercion can be suppressed  
with little inefficiency of the type checker.
I occasionally use immediate objects to build polymorphic objects 
without writing type annotations.
(I mean, if I build polymorphic objects through class definitions,
I may need to define the classes with many type parameters.)
For the same reason, I thought that it would be nice 
if I could omit explicit coercion in some cases
when it does not cause inefficiency a lot.