Will structs and value types (like C#'s) be included in Java 7?

孤者浪人 提交于 2019-12-10 14:48:34

问题


Will structs and value types (like C#'s) be included in Java 7?


回答1:


Not that I've seen in any proposals - and I'm pretty sure we'd have heard about it by now.

Note that this would be a very significant JVM change, rather than just a language change as many of the existing proposals are.




回答2:


Here is John Rose's (an Oracle JVM developer) blog post about this proposal. It has been around for a while, but not as an official JSR. It seems unlikely to happen even in java 9.

http://blogs.oracle.com/jrose/entry/tuples_in_the_vm




回答3:


As posted elsewhere, from JDK architect John Rose

http://cr.openjdk.java.net/~jrose/values/values-0.html

This is part of Project Valhalla (http://openjdk.java.net/projects/valhalla/) and is planned for Java 10.




回答4:


It's not listed among the features expected according to the Java Wikipedia page. It would also require a very large (and almost certainly breaking) change in the JVM.




回答5:


that's actually not the best thing from c# which you can borrow, I think that stuff like

var x = 1;
list.Select(o => o.Something = true) lambda expressions

and some stuff from as or javascript like:

o = new Object();
o.MyNewProp = 5
o.Do = new Function(){}

would be much better



来源:https://stackoverflow.com/questions/3372195/will-structs-and-value-types-like-cs-be-included-in-java-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!