lambda expression parameters

Michael Nascimento misterm at gmail.com
Tue Dec 18 15:55:32 PST 2012


I think they should be final when inferred. If types are formally
declared, then they should not, to avoid confusion (too similar to
regular parameter declaration) and to allow a way out if people really
want to.

Regards,
Michael

On Tue, Dec 18, 2012 at 9:50 PM, Stephen Colebourne
<scolebourne at joda.org> wrote:
> I would support making all lambda parameters final. The syntax is
> distinct and different anyway, so this is a very natural thing to do.
> It also goes very well with the multi-threading/parallel messaging
> that the API is aiming for.In fact, my first response was surprise
> that this wasn't how they already worked.
>
> Stephen
>
>
> On 18 December 2012 22:31, Brian Goetz <brian.goetz at oracle.com> wrote:
>> Agreed that this is something that has the right "nudge" to it.
>>
>> One downside is that there is no keyword for "not final."  Which means
>> this is not a question about "final by default", but "final by decree",
>> unless we're willing to introduce new syntax for mutable (which we're
>> not.)  That's not terrible -- most people would probably never even
>> notice.  So, reasonable suggestion.
>>
>>
>>
>> On 12/18/2012 4:40 PM, Venkat Subramaniam wrote:
>>> Hi
>>>
>>> Is there plans to make the inferred parameter of a lambda expression final by default.
>>> Right now, we can't specify the parameter is final unless we provide it with the type.
>>>
>>> In the spirit of leaning towards immutability, which is a better practice, would it be possible to
>>>
>>> (a) make all inferred parameters of lambda expressions final, and
>>> (b) to make it non-final, force the developers to explicitly request (like the mutable in F#).
>>>
>>> It's more of a wish-list, if that's something that can be considered.
>>>
>>> Thanks,
>>>
>>> Venkat
>>>
>>
>


More information about the lambda-dev mailing list