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
exception Failure and failwith
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-06-21 (11:15)
From: Luca Pascali <pasckosky2000@y...>
Subject: Re: [Caml-list] exception Failure and failwith
Luc Maranget wrote:

> [...]
>Failure is considerd 'internal' (or built-in, or predefined) by the compiler.
>The same applies for instance to the 'option' type constructors None
>and Some.
>Have a look at the manual
I missed it, now I've seen.

>You could have expected that 'Failure' is defined in standard library
>(eg in module Pervasives) but it is not the case.
>So the answer is: tou can't.
>If you shadow OCaml's Failure by your definition, then
>you have no longer access to OCaml's Failure.
>-- Luc Maranget
It's what I was afraid of.
I got it. Anyway let me make a consideration: It would be nice to have a 
way (a fake module named Core,for example) to access the core types, 
exception and definitions in case someone shadows the original one.

For example if you open Stream module, it redefines the Failure exception.
I will try to avoid this kind of job, but there are already some 
external modules that do this.

Since I received answers only directly, I would like to forward also the 
answer I got from  Julien Signoles, that suggests to define an exception 
with a new name, equal to the old one

exception Prim_Failure = Failure

to get rid of any further shadowing.

Thanks for the answers.



Luca Pascali

Baretta DE&IT
A division of Baretta SRL

tel. 02 370 111 55
fax. 02 370 111 54

Our technology:


Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB