Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Forcing local scoping

Reply
Thread Tools

Forcing local scoping

 
 
Joe Seigh
Guest
Posts: n/a
 
      02-04-2007
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.

--
Joe Seigh

When you get lemons, you make lemonade.
When you get hardware, you make software.
 
Reply With Quote
 
 
 
 
Tom Hawtin
Guest
Posts: n/a
 
      02-04-2007
Joe Seigh wrote:
> 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
 
Reply With Quote
 
 
 
 
Joe Seigh
Guest
Posts: n/a
 
      02-05-2007
Tom Hawtin wrote:
> Joe Seigh wrote:
>
>> 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.
>


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.

--
Joe Seigh

When you get lemons, you make lemonade.
When you get hardware, you make software.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ 7.17 What's the difference between dynamic and lexical (static) scoping? Between local() and my()? PerlFAQ Server Perl Misc 0 04-15-2011 04:00 AM
FAQ 7.17 What's the difference between dynamic and lexical (static) scoping? Between local() and my()? PerlFAQ Server Perl Misc 0 01-06-2011 05:00 PM
Scoping of components No One ASP .Net 4 10-25-2004 01:24 PM
Scoping and Synchronization No One ASP .Net 2 10-24-2004 07:10 PM
Stupid Scoping Problem? =?Utf-8?B?RGF2ZQ==?= ASP .Net 3 01-30-2004 07:06 PM



Advertisments