Local functions

Alex Buckley Alex.Buckley at Sun.COM
Wed Feb 10 16:33:08 PST 2010


Neal Gafter wrote:
> On Wed, Feb 10, 2010 at 2:35 PM, Alex Buckley <Alex.Buckley at sun.com> wrote:
>> 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.
> 
> Interesting.  The point of disallowing the use of "this" would be,
> presumably, that the enclosing object might be mutable.  By that same
> precise logic, we should disallow access to members of the enclosing
> class as well (after all, the "this" variable is itself final, while
> its members might not be).

No. Doug's point was that many things may be accessed, but defaults must 
be cautious.

Alex


More information about the lambda-dev mailing list