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] Another q about many types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-02-15 (13:54)
From: Christian Gillot <cgillot@g...>
Subject: Re: [Caml-list] Another q about many types
El dv, 15-02-2002 a las 02:48, Ryan Tarpine escribió:
> In the language I'm trying to implement, to raise an exception, the user 
> needs to create an instance of an exception class.  So, in my 
> implementation, I wanted to define an exception whose sole argument would be 
> an instance of a class.  But, I designed instances to be records containing 
> a polymorphic variant, which makes the record type itself polymorphic.  Is 
> there some way to raise exceptions with polymorphic arguments, or some other 
> possible way of implementing this?
I stumbled on this too ;o) Basically exception must only contains
concrete types (no polymorphics ones) otherwise it would break type
system. (Gurus can correct if this statement is wrong). This is also
why we need to use different operators for float (+.) and ints (+).
  So you've got to redesign your application in a way that it doesn't 
need polymorphic exceptions. 
  What you would need is Gcaml : pauillac.inria.fr/~furuse/generics,
but I recommend you to stick with Ocaml.


Christian Gillot <cgillot@gruposbd.com>
GNU/Linux programmer
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr