Forcing local scoping

J

Joe Seigh

Is there any way of forcing local scoping that's a little cleaner
than using an anonymous inner class? I need to be able to enforce
some before entering block and after entering block actions.
Anonymous inner classes seem a little kludgy.
 
T

Tom Hawtin

Joe said:
Is there any way of forcing local scoping that's a little cleaner
than using an anonymous inner class? I need to be able to enforce
some before entering block and after entering block actions.
Anonymous inner classes seem a little kludgy.

I don't think they are a kludge (well other than the implementation into
the class file format). It's just the syntax is highly verbose for a
simple ExecuteAround.

You could generate a proxy for appropriately annotated methods, but that
would be even more of a kludge.

Tom Hawtin
 
J

Joe Seigh

Tom said:
I don't think they are a kludge (well other than the implementation into
the class file format). It's just the syntax is highly verbose for a
simple ExecuteAround.

You could generate a proxy for appropriately annotated methods, but that
would be even more of a kludge.

Plus it's not really a block but a method call so you lose local variable
scoping. Ah well, I'll probably just go with requiring the user to use
enter and exit block actions in a try/finally block. Thanks anyway.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top