News for hackers. Stuff that matters.
Re:Underscore is a keyword in Java 9, use this script to che... by virtualwhys on Saturday January 14, 2017 @11:30AM (#13399115)
Wonder what they'll do with `_`?

At last year's JLS the keynote mentioned that reserving underscore did not mean that Java is becoming Scala. And yet, what else are they going to with it other than to slowly integrate Scala idioms into the language?

If alternative JVM languages gain enough traction perhaps archaic boilerplate like having to define Java getters/setters, equals, hashCode and toString on data classes will replaced sooner than later with terse "modern" equivalents found in C#, Scala, etc.

Re:Underscore is a keyword in Java 9, use this script to che... by alblue on Saturday January 14, 2017 @11:43AM (#13399188)
The use of _ as a discardable placeholder has been present in many languages in the past, such as Haskell and Prolog. These aren't necessarily Scala-isms that Java is adopting; they have a much richer history.
Re:Underscore is a keyword in Java 9, use this script to che... by nilved on Saturday January 14, 2017 @11:50AM (#13399231)
The way Scala uses them is very different from Haskell or Prolog. They are used to create lambdas, not discardable placeholders. E.g. `List(1, 2, 3) map (_ + 1)`.
Re:Underscore is a keyword in Java 9, use this script to che... by pharrington on Saturday January 14, 2017 @02:48PM (#13400198)
_ has a lot uses in Scala, one of them being to create lambdas, another as placeholders when pattern matching. for example val List(a, b, _, d) = List(1, 2, 3, 4)
Re:Underscore is a keyword in Java 9, use this script to che... by cs02rm0 on Saturday January 14, 2017 @01:41PM (#13399829)
...we are certainly NOT going to do Scala's "wunderbar". However, things it might be used for include things like "I don't want to give this variable a name" (such as catch parameters that are never used.)

http://git.net/ml/lambda-development-java/2013-07/msg00350.h...

Re:Underscore is a keyword in Java 9, use this script to che... by chvid on Saturday January 14, 2017 @12:20PM (#13399393)
Good question; to me _ has no obvious meaning. And in general Java is verbose - ie. the keyword for private is "private" rather than some shorthand or symbol. Maybe they should just not use it.