开发者

Will Java 7's MethodHandles provide multiple dispatch?

Will method-handle objects d开发者_开发技巧irectly provide the ability to invoke methods using multiple-dispatch. If so, is only double-dispatch supported, or will the dispatching mechanism take as many arguments as necessary into account? If multiple dispatch is supported, any code examples would be particularly appreciated.

Thanks in advance,

Mackenzie


I doubt it. It is not listed on the OpenJDK feature list http://openjdk.java.net/projects/jdk7/features/, and I have seen nothing suggesting its inclusion. Also, this question already tops the google search for "Java 7 multiple dispatch." Stack overflow has exception SEO, but that suggests almost no discusion. Also, multiple dispatch is inherently slower, and would require both JVM and language changes to make work well, so I dont see it being included in the near term.

Note: the visitor pattern can be used to avoid much of the need for multiple dispatch.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜