简体   繁体   English

Java 7关闭语法

[英]Java 7 closure syntax

I download the last Java build b96- Feature Complete for testing the new JDK features but I can't figure out which syntax using for testing closures! 我下载了最新的Java构建b96- Feature Complete,用于测试新的JDK功能,但是我不知道用于测试闭包的语法!

Can I test it? 我可以测试吗?

Which syntax has been approved in the final release? 最终版本中批准了哪种语法?

I can't be certain, but I think this syntax: 我不确定,但是我认为这种语法:

  // function expressions
  #(int i, String s) {
    System.println.out(s);
    return i + s.length();
  }

  // function expressions
  #(int i, String s) (i + s.length())

  // function types
  #int(int, String)

Is going to make it through as per http://docs.google.com/Doc?id=ddhp95vd_0f7mcns 将按照http://docs.google.com/Doc?id=ddhp95vd_0f7mcns进行处理

To answer your question, no final syntax has been approved and, despite M8 being listed as the feature-complete milestone, it doesn't have all the proposed features. 要回答您的问题,尚未批准任何最终语法,尽管M8被列为功能完整的里程碑,但它没有所有建议的功能。 You can read here about the feature in its current form, but much discussion is going on now and it has quite a ways to go. 您可以在此处阅读其当前形式的功能,但是现在正在进行很多讨论,并且还有很长的路要走。 Additionally, the syntax is going to be revisited and likely changed (at least some) later, once more pressing issues are worked out. 此外,一旦解决了更多紧迫的问题,该语法将被重新考虑并可能在以后(至少一些)进行更改。

Also, project-lambda code is being worked on in a fork of the main line JDK7 (I believe), so I don't think any of it would be in the build you downloaded. 另外,project-lambda代码正在主行JDK7的分支中进行处理(我相信),因此我认为其中任何内容都不会出现在您下载的版本中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM