"it"? "#"? ""?
Reinier Zwitserloot
reinier at zwitserloot.com
Tue Nov 22 08:53:23 PST 2011
On Mon, Nov 21, 2011 at 4:39 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
>
> (_, _) -> _ + _
>
This is starting to look like risque ASCII art :)
>
> and probably bitch about "why did you special-case the single-argument
> wunderbar but not the general case".
>
>
The solution seems simple: Avoid doing that (using underscore as variable
name for the single argument case) in all examples as lambda is released to
the public. Just use 'a'.
As long as the community does not decide that _ is the de facto identifier
name for the single arg case, the same way the community decided that the
letter i is the de facto name for number range for loop, we're good.
Because, if people look at examples and actually see the underscore in
action, that would be bad - it's very easy to get the wrong idea about
what's going on based on familiarity with other languages. However, I don't
think its reasonable to worry about programmers assuming java works just
like i.e. scala, effectively throwing random characters at the compiler in
the vain hope that somehow it'll work just the way they planned, and _then_
getting the wrong idea.
More information about the lambda-dev
mailing list