Missing methods in MemorySegment class
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu Oct 20 11:02:52 UTC 2022
Hit send too fast :-)
It is true that the "missing" functionality can be emulated by just
calling the corresponding "get" methods (for both booleans and bytes).
At the same time, it is also true that going down this path forces an
unnatural split in clients that only want to reason about logical
indices, so I'm sympathetic to your request (even if it leads to two
ways to do the same thing).
Maurizio
On 20/10/2022 11:59, Maurizio Cimadamore wrote:
> That is a good point.
>
> I think getAtIndex with bytes was originally left out, since it was
> essentially a replica for get/byte.
>
> But the boolean one is not, since it's doing a conversion, so at least
> that one should be there - and then I agree that, for uniformity, it
> feels strange not to have them all.
>
> Maurizio
>
> On 20/10/2022 11:46, Red IO wrote:
>> The convenience methods
>> getAtIndex(layout, index)
>> setAtIndex(layout, index, value)
>> Are missing for the primitive types byte and boolean. I see no reason
>> to exclude them since they simply calculate the required offset based
>> on layout and index.
More information about the panama-dev
mailing list