Local functions
Alex Buckley
Alex.Buckley at Sun.COM
Wed Feb 10 14:35:50 PST 2010
Neal Gafter wrote:
> On Wed, Feb 10, 2010 at 11:26 AM, Alex Buckley <Alex.Buckley at sun.com> wrote:
>> Method references are in scope for this project, though I tend to think
>> that relying on ordinary methods ignores Doug's plea for clear
>> demarcation of (and restrictions on) code that experiences parallel
>> execution.
>
> Sounds great, but it seems to me that's orthogonal to lambdas and
> function types. Are you considering how to distinguish "parallel"
> closures from other closures? I don't think restricting them to the
> parallel use cases is wise.
I agree demarcation of/restrictions on parallel code are orthogonal to
lambdas and function types. A glance at the FindBugs bugs for
multithreaded correctness shows little the language could internalize to
make the body of a lambda expression correct by construction. (Short of
horrendous type system "enhancements".)
That said, I am happy to prioritize parallel use cases over non-parallel
use cases. Sun is not aiming to add lambdas to allow control abstraction
or DSL building, but rather to support FJ ParallelArray and APIs like
it. So I'm fine if lambda bodies are restricted along the lines Doug
suggested. ("Ideally, for the sake of parallel execution, we'd disallow
automatic sharing of locals and automatic elevation of "this", "return"
or "break" to enclosing scopes.") The Lambda strawman is at odds with
some of those restrictions; resolution is forthcoming.
Alex
More information about the lambda-dev
mailing list