Too terse and too alien?
Neal Gafter
neal at gafter.com
Tue Jun 1 14:38:16 PDT 2010
On Tue, Jun 1, 2010 at 2:26 PM, Alessio Stalla <alessiostalla at gmail.com>wrote:
> On Tue, Jun 1, 2010 at 11:02 PM, Neal Gafter <neal at gafter.com> wrote:
> > I think single-expression closures will be the most common form,
> especially
> > in the context of the kinds of aggregate (possibly concurrent) operations
> > that is cited as the primary motivation for adding closures at this time.
>
> Are those aggregate operations expected to be usually limited to
> simple math, assignments, ternary ifs and method calls with no
> try-catch, switch, loops?
In my experience, yes, virtually always.
> I also think other
> important use cases for closures are the java.util.concurrent API, to
> execute whole blocks of code asynchronously, and event handlers, and
> both usually consist of much more than a single expression.
>
Right. Those other contexts are ones in which transparency is more
important, and yielding a result value is rare.
> An extra return does make a difference, particularly if we ever hope to
> more
>
> fully support transparency ala BGGA in a future extension.
>
Well, AFAIK return is mandatory for multiple-statement closures, with
>
the semantics of returning a value from the closure, so this already
> makes them incompatible with the BGGA proposed behaviour (which I
> don't like btw, but that doesn't count).
>
Yes, that is the current state of the proposal, which is why it's valuable
to address it now.
More information about the lambda-dev
mailing list