Fwd: Remi's comments on Any

Brian Goetz brian.goetz at oracle.com
Mon Jan 5 16:04:09 UTC 2015

> I understand that the folks who have to implement this stuff on the VM
> are naturally looking for the thing that is simplest to implement. But
> if that ease of implementation surfaces itself as extra complexity in
> the type system, I don't think it does anyone a favor.

Welcome to the real world :(

Working within the architecture of the JVM is not mere laziness.  If the 
language-level abstractions we give people for modeling programs don't 
match up appropriately with the VM-level abstractions for representing 
those programs, this is not doing anyone a favor, because we are selling 
(harmful) fictions.

As a simple example, suppose than in Java 5, we pushed autoboxing 
deeper, and let you write:


and really that was just sugar for List<Integer>.  This gives the 
illusion of a prettier type system, but comes at the cost of some nasty 
fall-off-a-cliff performance that is even more confusing that what we've 
got now.

If all we cared about was simplicity of implementation, we'd probably 
already have done something (dumb) like this.

I get that you've convinced yourself that its possible to just magically 
remove the complexity (just introduce Any!) and then you get the best of 
both worlds.  But given that the JVM implementation experts have not 
responded with "gee, brilliant idea, thanks!", perhaps you should 
consider that this approach is not as straightforward as you think?

More information about the valhalla-dev mailing list