ST Blocks vs Java anonymous classes ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • panu

    #1

    ST Blocks vs Java anonymous classes ?

    I just browsed the book on "Apache Jakarta Commons".
    Seems like Jakarta 'closures' are much like Smalltalk
    blocks, yet not quite.

    Any thoughts on whether Java's anon classes will
    match up with ST blocks eventually?

    I see the Java anon-class syntax as impractically
    verbose. But otherwise it would almost seem able
    to simulate ifTrue:ifFalse: [] etc.

    Feels like all Java needs is a good "block-oriented"
    class-library, just like Smalltalk's. A streamlined
    syntax for inner classes perhaps. Static typing,
    already optional in ShellBeans & Groovy.

    Will Java become Smalltalk in disguise?
    When will Java have full closures?


    Thanks
    - Panu Viljamaa

  • Björn

    #2
    Re: ST Blocks vs Java anonymous classes ?

    Chris Uppal wrote:[color=blue]
    > [BTW, comp.lang.java has been defunct for about 10 years --
    > comp.lang.java. programmer would be the correct group to xpost to on this
    > subject]
    >
    > panu wrote:
    >
    >[color=green]
    >>Any thoughts on whether Java's anon classes will
    >>match up with ST blocks eventually?[/color]
    >
    >
    > There's no direct equivalent of the ^ construct. I.e. translating:
    >
    > aCollection do: [:each | each somecondition ifTrue: [^ each]].
    >
    > into the "obvious" Java equivalent (and leaving the #ifTrue as a Java
    > conditional statement) would not "return" out of the loop's caller.
    >
    > You could fake it with exceptions, but it'd be unbearably messy (not to mention
    > slow). The only way to fix it would be to change the JVM spec, and that's not
    > going to happen.
    >
    > -- chris
    >
    >[/color]

    Comment

    Working...