On 10/16/06, David Vallner <david / vallner.net> wrote:

> For something more non-trollish, the Java rocky way towards lambdas and
> closures via anonymous inner classes (eww) just might mean that if
> either CICE or BGGA get promoted into the language, you could use a
> stateful command-object implementing a SAM type interchangeably with a
> closure, eliminating the need for a first-class (and isolated) closure
> concept. Which I can't think of what it could be good for, but then
> again, noone knew what continuations were good for for a webapp until
> recently either.

Isn't this sort of torture governed by international law? *smirks*

On a serious note, I wonder how well closures will work out in Java.
It just seems somewhat out of place to me.  Even in ruby there are
instances when blocks are a pain to work with.  If you want to pass
more than one block to a method, it looses its elegant looks, IMHO:

    # okay, but eh...
    foo(lambda do |x|
        bar
    end, lambda do |y|
        baz
    end)

    # I think the standard way is worse in this case
    foo(lambda do |x|
        bar
    end) do |y|
        baz
    end

    # probably the way to go
    l1 = lambda {|x| bar}
    l2 = lambda {|y| baz}
    foo(l1,l2)

I'm not quite sure how to solve that though? Maybe this? =)

    (foo (lambda (x) (bar))
          (lambda (y) (baz)))


-- 
Lou.