Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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
><http://caml.inria.fr/pub/docs/manual-ocaml/manual033.html#htoc249>
>  
>
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

-- 

*********************************************************************
Luca Pascali
luca@barettadeit.com
asxcaml-guru@barettadeit.com

http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

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

Our technology:
http://www.asxcaml.org/
http://www.freerp.org/


	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it