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
Question on language design (keywords vs Pervasives)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-08-22 (09:15)
From: John Max Skaller <skaller@m...>
Subject: Re: Question on language design (keywords vs Pervasives)
Pierre wrote:

> I'm sure that there is no ``more primitive function'' than raise to
> raise an exception. So sorry, you cannot define raise ``in terms of a
> more primitive function'' in Caml. 

Perhaps my intent was not understood. The idea is to provide
a primitive '_raise' construction, but provide a wrapper function
'raise' in the standard library which does nothing but call _raise:

	let raise ex = _raise ex

which allows the raise function to be rebound by the client,
catching all exceptions raised using the 'raise' function
in those sources where the client has in fact rebound 'raise'
before use. Naturally, this will not affect (compiled) library code
unless it, too, is recompiled, so not all exceptions are trapped
this way. 

This can be done right now by the client, simply defining

	let raise' ex = raise ex

even if raise is a primitive construction, provided that
the source module uses raise' everywhere, rather than raise.
So it can be done now, by search and replace of raise by raise',
which is not really much harder than rebinding.

John (Max) Skaller,
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper
download Interscript