What happened to the "mutable struct" debate?

Andrew Purtell apurtell at apache.org
Fri Jan 23 03:31:06 UTC 2015

I've also recently arrived here. This would seem to be a fairly important
writeup left wanting.

Our mantra is “codes like a class, works like an int.”

Stating the obvious, from a newcomer's perspective, ints are mutable.

In my part of the Java universe, we are under pressure because data volume,
response latency requirements, and arrival rates are too high for copying
the bulk of data (in GC or working with immutable data structures). This
class of problem is encompassing more and more of the so-called big data
space as time goes on, and the best available existing strategies for a
Java application is a resort to kludgy custom representations with
primitive arrays or "structs" stored off-heap (with use of Unsafe for
allocation and direct access). Java cannot provide object-like views over
data that is simply too bulky for copying around. The impedance mismatch
suggests consideration of alternatives. Some in the space are abandoning
Java for alternatives like C++, C#, and Go. Maybe I fundamentally
misunderstand the intent and usefulness of value types and they cannot be
an answer for this, but more information available in this regard would be
very helpful, especially if there is another option. I think increasingly
the assumption is Java will concede the space of big data applications to
other languages.

On Thu, Jan 22, 2015 at 2:36 PM, Brian Goetz <brian.goetz at oracle.com> wrote:

> Hi Moh!  Good to have you here.
> The sad answer is: we've got a long list of "road not taken" items for
> which we intend to write up our thoughts on why those roads were not
> taken.  As you can imagine, though, such writeups compete for time with
> many other activities, and so they often lag behind...
> On 1/22/2015 5:30 PM, Rezaei, Mohammad A. wrote:
>> I recently joined the list and I can't find any references to the
>> justification behind restricting value types to final fields (aka
>> immutable).
>> As Brian says (http://mail.openjdk.java.net/pipermail/valhalla-dev/2015-
>> January/000734.html), "There are some people who would prefer something
>> more like mutable structs" and yet, the value types proposal (
>> http://cr.openjdk.java.net/~jrose/values/values-0.html) takes
>> immutability as a given.
>> Is the issue considered settled? Is the justification documented?
>> Thanks
>> Moh

Best regards,

   - Andy

Problems worthy of attack prove their worth by hitting back. - Piet Hein
(via Tom White)

More information about the valhalla-dev mailing list