Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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.

Regards,

-- 
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