Value-Based Classes vs Value Types

Nicolai Parlog nipa at codefx.org
Sun Feb 15 16:52:33 UTC 2015


 Hi!

I'm currently writing a post about value-based classes warning people
about what not do with them and why those limitations exist. Now that
the article is more or less done, I realize that it heavily relies on
a concrete idea of how the relation of value-based classes and value
types looks like.

The State of the Values from 04/2014 [1] says "In fact, it seems
likely that the boxed form of every value type will be a value-based
class." If I understand this correctly, it's like we're implementing
'Integer' now, waiting for 'int' to be implementable in a couple of
years.

Or is it more like we are already writing the value types, waiting for
the language to catch up so we can then add the right qualifiers and
effectively transform value-based classes into value types? To
continue the example from above, do we currently write Integer but by
replacing "public class Integer" with "public value integer" (syntax
is irrelevant) we effectively create 'int', leaving all other code
untouched (because we followed all the rules)?

Do even more options exist? Btw, I'm not asking this to get a detailed
picture of how it's gonna be. I'm rather looking for an explanation
which I can repeat (and is not already known to be wrong) for how
value-based classes relate to value types and why this creates the
documented limitations.

 so long ... Nicolai


[1] http://cr.openjdk.java.net/~jrose/values/values.html



-- 

PGP Key:
    http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509

Web:
    http://codefx.org
        a blog about software development
    http://do-foss.de
        Free and Open Source Software for the City of Dortmund

Twitter:
    https://twitter.com/nipafx



More information about the valhalla-dev mailing list