Proposal for Decimal64 and Decimal128 value-based classes
Douglas Surber
douglas.surber at oracle.com
Wed Mar 31 16:46:01 UTC 2021
I'm sure this would be a huge disruption, but I'll throw it out anyway. I'd be perfectly happy if assigning null to a Decimal64/128 container was not allowed, whether it is a reference or a value.
I haven't followed the progress of Valhalla closely. It would be reasonable to delay Decimal64/128 until Valhalla so long as that isn't more than a very few cycles. My concern is that Valhalla is a challenging project. I would not want Decimal64/128 to get hung up because Valhalla is delayed or even worse canceled.
Douglas
> On Mar 31, 2021, at 8:01 AM, Maurizio Cimadamore <maurizio.cimadamore at oracle.com> wrote:
>
>
> On 31/03/2021 15:23, Douglas Surber wrote:
>> Rather than waiting on Valhala I would prefer that this project be fast tracked and added to OpenJDK ASAP.
>
> There is a catch here.
>
> While in principle, we can add these as value-based classes, and migrate to Valhalla later, there is a biggie difference between doing it before/after.
>
> When it comes to "migrated" primitive classes, there is a choice in how to interpret the "old" utterances of the class name. Let's say that class Foo is migrated to be a primitive class; does that mean that all uses of Foo in existing program will automatically get flattening? Or will references to Foo be interpreted in a conservative fashion, so as to allow the same operations as before? One important difference in semantics is assignment to `null` which is prohibited under flattened semantics, but allowed under "indirect" (or by reference, if you will) semantics.
>
> In other words, under the current plan, if Decimal128 is added now and migrated later, utterances of Decimal128 will behave like they used to pre-Valhalla, and, to take advantage of flattening you would need to opt-in with some keyword (e.g. Decimal128.val).
>
> To me this is kind of a strong argument against going with these classes now (as much as I understand how useful they'd be even w/o Valhalla) - and preserving the "good" name (Decimal128) for the flattened case seems worth, IMHO, waiting few more cycles.
>
> Maurizio
>
More information about the core-libs-dev
mailing list