Hiding the lambda proxy frame

Remi Forax forax at univ-mlv.fr
Tue Jun 11 14:43:27 PDT 2013

On 06/11/2013 11:35 PM, Brian Goetz wrote:
> Right.

so for a non serializable lambda, the compiler can use the name of the 
local variable
used for the capture conversion if available.
The cost is that the compiler needs to be smarter.
An additional benefit can be a better* toString().

* I know, we haven't decided to have meaningful toString

> On 6/11/2013 5:34 PM, Remi Forax wrote:
>> On 06/11/2013 07:23 PM, Brian Goetz wrote:
>>>> He raises a good point that the compiler translation should try to
>>>> provide a better name.
>>>> By example,
>>>>    Runnable myRunnable = () -> System.out.println("hello");
>>>> should result in a lambda that instead to be called "lambda$0",
>>>> instead the compiler should try to name it something like
>>>> lambda$myRunnable
>>>> (or lambda$myRunnable0, ..., if there is a collision) if it's 
>>>> possible.
>>>> I think we already discuss about something like that in the light of
>>>> serialization,
>>>> but not in the stack trace context.
>>> We did discuss this in the stack trace context at least once, but
>>> apparently we never converged.  And the two problems interact; things
>>> that enhance readability sometimes come at the expense of name 
>>> stability.
>> Name stability is only needed when serializing a lambda, right ?
>> Rémi

More information about the lambda-spec-experts mailing list