On 06/11/2011 02:50 AM, Charles Oliver Nutter wrote:
On Fri, Jun 10, 2011 at 7:36 PM, John Rose<john.r.r...@oracle.com>  wrote:
Yes.   Put the postCall wrapper *outside* the postException wrapper.  That way 
the postCall guy won't participate in the special exception processing.

If postException catches and discards the exception, then it will return 
normally to the postCall wrapper.

If you want the postCall wrapper to distinguish the caught-exception case from 
the normal-return case, you may have to contrive a boolean flag variable, for 
them to share, so the inner wrapper can tell the outer wrapper what happened.
I have gone from depression to elation. To avoid this happening again,
I'm going to spend part of the weekend wiring up all such cases in
JRuby and make damn sure I've got every angle covered.

Thanks for the help, John!

- Charlie

There is two way to implement try/finally,
one is to store the exception in the catch, let the catch fall through the postCall and rethrow the exception after. The other is to catch the exception, call the postCall
and retrow the exception (you group postCall and rethrow with a fold
(here you can even use filterReturnValue)) and call postCall after the tryCatch, again by folding the catchException and postCall. In that case, postCall appear twice, this is the strategy implemented by javac or eclipse to implement a try/finally.

Anyway, this mean I (or Charlie or anyone who want) have to write new sample
for the cookbook.

Rémi

--
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to jvm-languages@googlegroups.com.
To unsubscribe from this group, send email to 
jvm-languages+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en.

Reply via email to