Accessing non-final local variables from a lambda expression
Fredrik Öhrström
fredrik.ohrstrom at oracle.com
Sun Feb 28 13:16:21 PST 2010
Peter Levart wrote:
> With "frame object" I meant an object, allocated on the heap whose class is constructed by
> compiler and holds all captured local variables (whether final or non-final). I don't know why but
> this terminology is used by Neal and others.
>
> With MethodHandles, local vars can be captured one-by-one via (MethodHandles.insertArgument) but
> it might still be better to construct a single "frame object" to hold all of them when their
> number reaches a certain limit or when at least one of them is non-final.
>
Be aware that insertArgument might very well be implemented as
a "closure" using a frame object. See the sample implementation in:
http://tinyurl.com/q8v92o#InsertArgument
and the appendArgument implementation at the end of
http://tinyurl.com/pekyrc
//Fredrik
More information about the lambda-dev
mailing list