VarHandle prototype pushed
brian.goetz at oracle.com
Fri Aug 8 17:56:03 UTC 2014
> Personally, I like the language enhancement because I am not fond of declaring wrapper objects -- it's more boilerplate. The tests seemed to confirm this for me. I like the inline convenience of the proposed keyword.
I think when you finish pulling on the string entailed by the suggested language enhancements, you’ll find they’re not as clean as you might imagine. For example, where are the methods on “foo.volatile” declared? Magic is required.
> But I am more interested in the decision to make VarHandle an abstract class over an interface. Why wouldn't a pure contract be preferred?
Note that MethodHandle is an abstract class too! (Most people don’t notice this.) There are implementation constraints that make this particular wart preferable (both security and performance constraints.)
Once we have value types, we can wrap a more type-safe value facade around it without any cost.
More information about the valhalla-dev