Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] GC and file descriptors
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-11-19 (01:33)
From: Martin Berger <martinb@d...>
Subject: Re: [Caml-list] GC and file descriptors
> No. The problem is it breaks abstraction.

i disagree. the exceptions thrown are part of the
specification the function tries to meet.

>  For example consider
> 	map f list
> which currently has signature
> 	('a -> 'b) -> 'a list -> 'b list

i dont see a problem here. simply use exception specification
polymorphism: map has type

    forall A B E: (A -> B throws E) -> list[A] -> list[B] throws E.

while i have not thought about this in detail, i dont think there's
a type theorectic problem with this.

> The problem is that exceptions thrown are typically
> implementation details so it would often be an error
> to include the exception type in the function signature.

i do not think that the exception thrown is an implementation

> Well, exceptions are 'really' wrong: they're 'really' a constraint
> on the type of the argument, for example 
> 	divide: float -> float not zero -> float
> but expressed negatively (throws divide by zero).

that's one way of looking at it. another would be to say
we have dependent types ... unfortunatly neither rich
specifications nor type dependencies lead to decidable
type inference so we need to be less precise.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: