Structs

Richard Carlsson richardc@REDACTED
Thu Jan 16 14:25:01 CET 2003


It's actually just been implemented all the way through,
and will most probably be in the next release from OTP.

Actually, you'll even be able to write the following,
if you intend to switch on the result of the operation
in the normal case when everything worked:

	try Exprs of
	   ... -> ...
	catch
	   ... -> ...
	end

(i.e., skipping the 'of ...' part is equivalent to writing
'of Result -> Result', if Result is a new variable)
Credits to Fredrik Linder for this idea.

    /Richard


On Thu, 16 Jan 2003, Luke Gorrie wrote:

> What I'd like is a 'try-catch' language feature that I've heard Robert
> Virding talk about, where you say something like:
> 
>     try E
>     catch
>         Pat1 -> ..;
>         ...
>         PatN -> ...
>     end
> 
> And it only catches exceptions matching the patterns; others continue
> uncaught. That way we could use throw({error, Reason}) and catch
> {error, Reason}, and never have to worry about accidentally catching
> real crashes.




Richard Carlsson (richardc@REDACTED)   (This space intentionally left blank.)
E-mail: Richard.Carlsson@REDACTED	WWW: http://user.it.uu.se/~richardc/






More information about the erlang-questions mailing list