On Wed, 18 Feb 2026 18:45:22 GMT, Frederic Parain <[email protected]> wrote:
>> Joel Sikström has updated the pull request incrementally with two additional
>> commits since the last revision:
>>
>> - Add assert to check for invalid flags/bits
>> - Change type to be consistent with compiler type
>
> This is a very nice encapsulation of ArrayProperties. However, I'm wondering
> if the transformation could go one step further and make ArrayProperties
> instances immutable, because after their creation, there's no reason to
> change the set of properties of the array. This would prevent accidental
> modifications of the property set. It would also allow the creation of a
> static instance for the "default" set of properties independent from the
> constructors.
Thank you for the feedback @fparain. I had another go and introduced a sort of
builder pattern, where you can chain-call `.with_{null_restricted,
non_atomic}`, which returns a new ArrayProperties. That way the ArrayProperties
instance itself is immutable and if you'd want to change it you have to
reassign it, which can be guarded by const variables/fields.
With this I also introduced two static methods for getting an Invalid and
Default property. We could have them as static member variables, perhaps using
the `inline static` feature of C++17, but I think the methods are more
approachable.
-------------
PR Comment: https://git.openjdk.org/valhalla/pull/2114#issuecomment-3928881755