Link Details

Link 664927 thumbnail
User 811641 avatar

By dev.stonez
via mail.openjdk.java.net
Published: Sep 09 2011 / 09:19

After considering a number of alternatives, we decided to essentially adopt the C# syntax. We may still deliberate further on the fine points (e.g., thin arrow vs fat arrow, special nilary form, etc), and have not yet come to a decision on method reference syntax. The decision to choose this syntax was twofold: - The syntax scores "pretty well" on most subjective measures (though has cases where it looks bad, just like all the others do). In particular, it does well with "small" lambdas that are used as method arguments (a common case), and also does well with large (multi-statement) lambdas. - Despite extensive searching, there was no clear winner among the alternatives (each form had some good aspects and some really not very good aspects, and there was no form that was clearly better than the others). So, we felt that it was better to choose something that has already been shown to work well in the two languages that are most like Java -- C# and Scala -- rather than to invent something new.
  • 37
  • 0
  • 6182
  • 67

Comments

Add your comment
User 338269 avatar

Miloskov replied ago:

0 votes Vote down Vote up Reply

finally closures to Java and catching C# features.

User 423119 avatar

eriksensei replied ago:

0 votes Vote down Vote up Reply

eek! arrows! oh noes!!! itz too complicated!!! 1 !!! 1

User 174509 avatar

philho replied ago:

0 votes Vote down Vote up Reply

A sensible move, using a syntax used in many languages already (not only C# and Scala; they took it from predecessors, but they might be the most used, thus the most widely known/popular examples), and that is quite readable (once you get used to it).
I wonder how they will implement it. Special bytecode or just adding some anonymous class wrapper automatically?

User 854623 avatar

forax replied ago:

1 votes Vote down Vote up Reply

@philho,
a special bytecode introduces to support dynamic language in Java 7 (invokedynamic)

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Debugging JavaScript
Written by: Ashutosh Sharma
Featured Refcardz: Top Refcardz:
  1. Design Patterns
  2. OO JS
  3. Cont. Delivery
  4. Java EE7
  5. HTML5 Mobile
  1. Java EE7
  2. Spring Annotations
  3. Git
  4. Java
  5. REST