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
[Caml-list] OCaml 3.05 released
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-07-30 (08:15)
From: John Prevost <j.prevost@c...>
Subject: Re: [Caml-list] Serious typechecking error involving new polymorphism (crash)
>>>>> "xl" == Xavier Leroy <xavier.leroy@inria.fr> writes:

    xl> Yes, this is a serious bug with polymorphic methods and
    xl> fields.  Expect a 3.06 release as soon as it is fixed.  In the
    xl> meantime, you're welcome to experiment with polymorphic
    xl> methods and fields, but don't bet the farm on them...

Polymorphic methods should be safe, as far as I can tell, since method
calls provide natural points of polymorphism, and storage in the class
is not allowed to be polymorphic.  (That is, you can't pull the same
trick with an object because you can't store a polymorphic value to be
shared across multiple results from a method call, and any
insufficiently polymorphic value returned from a polymorphic method
call is caught.)

Can you share any plans for polymorphic records?  I can see no way to
make them safe except to restrict the contents to function values
(which prevents the use of abstract types which are safe, but is
survivable) or to extend the system so that any value may be
polymorphic.  (Which would then allow for the two argument types of :=
to be checked to see if they're equally polymorphic.)

I presume this second option might complicate typechecking
dramatically, though.  Otherwise, why avoid it?  (You can always use a
struct wrapper on the value at the moment to get the desired
effect--to make a list of map-type functions, for example.)


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