What happened to the "mutable struct" debate?
brian.goetz at oracle.com
Fri Jan 23 04:38:33 UTC 2015
> If Brian & co could somehow be swayed to add them, I suspect this would
> drag in the requirement that you should be able to pass them by reference.
> Without that, they're of marginal utility since you can't avoid copying
> costs. Passing things by reference would be yet another entirely new
> concept to java, and given some of the sentiment I've read on this list
> thus far, this would comatose some people.
Very much so. This is indeed Big Strike #1 against them; this is a new
big complexity that Java (platform and developers) have not had to deal
Which leads directly to Big Strike #2: passing mutable structs by
reference leads to interior pointers (pointers into the middle of
objects), which is a huge additional burden for the GC. (I'm told this
is one of the major reasons why .NET GC is so much slower than the JVM,
because they have to deal with this additional requirement.)
More information about the valhalla-dev