[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Modifing try-catch statement
- From: Florian Weimer <fw@...>
- Date: Sun, 19 Sep 2010 22:03:57 +0200
* James Rhodes:
> However, I want to modify the try-catch so that it can be of the form:
>
> try
> -- attempt code
> catch (Engine.DivideByZeroException e) do
> -- catch Engine.DivideByZeroException
> catch (Engine.Exception e) do
> -- catch Engine.Exception
> end
What about using guards?
try
-- attempt code
catch e if is(e, Engine.DivideByZeroException) then
-- catch Engine.DivideByZeroException
catch e if is(e, Engine.Exception) then
-- catch Engine.Exception
end
I think the syntax is still sufficienty concise.
If you follow this path, you don't have to force a particular object
system on users.