Re: Value types - compatibility with existing “value objects”
Paul Benedict
pbenedict at apache.org
Thu Jan 8 18:09:47 UTC 2015
Regarding “Value types” seem to assume that you will use it just for small
types and you will implement bigger types as objects (with different
syntax)."...
Value types are "final" which means it won't be possible to subclass.
However, I am disappointed with this restriction because I would like to
use inheritance as an easy way of composing value types. Brian, what are
your thoughts about this?
Cheers,
Paul
On Thu, Jan 8, 2015 at 10:17 AM, Palo Marton <palo.marton at gmail.com> wrote:
> I see your point and may be I'm too late with what I wanted to suggest.
> I know that you need to have good foundation for this, but this foundation
> will probably greatly influence possible future solution to value
> object/type compatibility.
>
> I will try to write down some general outline of my idea on how to
> implement value types and achieve this compatibility. It is very close to
> current proposal in its syntax, memory layout, value array implementation
> and it will probably work also with generic specialization. Where it
> differs is how is value type defined in class file and in method/field
> descriptors containing value type. (and it will also cause some change to
> vftable).
>
> It also addresses this (I think serious) problem in current proposal:
>
>
> -
>
> “Value types” seem to assume that you will use it just for small types
> and you will implement bigger types as objects (with different syntax).
> In
> practice this might be a problem. E.g. in computer graphics/vision you
> have
> vectors of various dimensions (2,3,4), matrices of various dimensions
> (2x2,2x3,3x3,4x3,4x4) and other similar immutable types. Having
> different
> syntax for these based on the size (2x2 matrix of floats is value type,
> but
> 4x4 matrix of float or 2x2 matrix of doubles should be object) will be
> really cumbersome.
>
>
>
>
More information about the valhalla-dev
mailing list