Version française
Home     About     Download     Resources     Contact us    
Browse thread
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe Raffalli <raffalli@u...>
Subject: Re: [Caml-list] Re: about toplevels
Daniel de Rauglaudre a écrit :
> 
> Hi,
> 
> On Wed, Jan 23, 2002 at 10:35:34AM +0100, Christian Gillot wrote:
> 
> > 3. the exceptions are NOT polymorphics
> > exception of 'a list is WRONG.
> 
> If they were, they could break the type system:
> 
>    exception Foo of 'a list;;
>    try raise Foo [3] with Foo l -> "abc" :: l;;
> 

If the type system kept an annotation in types indicating if an
expression may raise an exception, it would be correct (the above
program would still be ill typed though). This annotation is just a kind
of disjunction 
t or_raise ex1 or_raise ex2 ... it can be found in papers doing monadic
encoding of exceptions (and there are
two ways to do it: cps or disjunction which gives to kind of type
translation). 

raise Foo [3] has type  'a or_raise Foo of int list

try raise Foo [3] with Foo l -> l has type   int list.

This would be really nice, because the type system would infor you that
your program can not have uncaught exception.
(in soma cases)

To be not to verbose, you could disable by default the printing of
exceptions in types.

You should be carefull that a -> (b or_raise ex1) is different from (a
-> b) or_raise ex1 and that
(b or_raise ex1) -> a is just useless while (a -> (b or_raise ex1)) -> c
may be usefull. 


-- 
Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
-------------------
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