About ref-default-ness of primitive classes
Quân Anh Mai
anhmdq at gmail.com
Tue Apr 26 13:32:28 UTC 2022
Hi Valhalla experts,
I really like the idea of making the ref variant to be the alias of the
class name instead of the val variant. Aside from the mentioned ideas, it
always feels a little uncomfortable knowing that value-based classes such
as Optional will forever carry the compatibility baggage and not be able to
fully utilise the benefits of Valhalla. By going this path, contemporary
value-based classes can be migrated directly to B3, which will both improve
the performance of today's programs, and open the door for the future to
fully take advantage of primitive classes.
Regarding the nature to look secondary of the naming, I would propose
primitive classes be able to explicitly declare the name of their value
companions, similar to how int can be declared as the value variant of
Integer. This would remove the magic of basic primitive namings. At this
point, B2 and B3 seem to be almost the same, the final nail would be to
make a class not have the value variant unless it explicitly asks for one.
By the way, I feel that the problem of atomicity is being exaggerated.
Tearing comes from racy code that does not fully understand its
implications. As a result, while it should be taken into consideration, bad
code should not affect our design of Valhalla. And I think it should be
discussed after everything else has settled.
My apologies if these ideas are obvious and/or incorrect.
Regards,
Quan Anh
More information about the valhalla-spec-comments
mailing list