Forcing local scoping

Discussion in 'Java' started by Joe Seigh, Feb 4, 2007.

  1. Joe Seigh

    Joe Seigh Guest

    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.
     
    Joe Seigh, Feb 4, 2007
    #1
    1. Advertising

  2. Joe Seigh

    Tom Hawtin Guest

    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
     
    Tom Hawtin, Feb 4, 2007
    #2
    1. Advertising

  3. Joe Seigh

    Joe Seigh Guest

    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.
     
    Joe Seigh, Feb 5, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RGF2ZQ==?=

    Stupid Scoping Problem?

    =?Utf-8?B?RGF2ZQ==?=, Jan 30, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    352
    =?Utf-8?B?RGF2ZQ==?=
    Jan 30, 2004
  2. No One

    Scoping of components

    No One, Oct 23, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    362
    Kevin Spencer
    Oct 25, 2004
  3. No One

    Scoping and Synchronization

    No One, Oct 24, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    304
    Jeff Louie
    Oct 24, 2004
  4. PerlFAQ Server
    Replies:
    0
    Views:
    393
    PerlFAQ Server
    Jan 6, 2011
  5. PerlFAQ Server
    Replies:
    0
    Views:
    315
    PerlFAQ Server
    Apr 15, 2011
Loading...

Share This Page