[foreign-memaccess+abi] RFR: 8301228: Add more ways to resize zero-length memory segments
Maurizio Cimadamore
mcimadamore at openjdk.org
Fri Jan 27 11:23:46 UTC 2023
On Thu, 26 Jan 2023 21:59:03 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/foreign/ValueLayout.java line 437:
>>
>>> 435: */
>>> 436: @CallerSensitive
>>> 437: OfAddress withTargetLayout(MemoryLayout layout);
>>
>> I think it could still be nice to have `asUnbounded` as a shortcut for `withTargetLayout(sequenceLayout(JAVA_BYTE))`.
>>
>> WDYT?
>
> Perhaps we can leave it - but I'm on the fence, as I think having too many options can also be confusing (esp. given that the options are restricted) - should then we also add slicing methods which just remove spatial bounds? Also, it's probably a bit of a naming issue as well - e.g. if the two methods were telescopic, with same name - but one had no argument and can be explained as calling the other, I'd be more ok with it. But having both `withTargetLayout` *and* `asUnbounded` feels like you can do two very different things, as the names are unrelated.
I've decided to just focus on the primitive operations for now. New overloads can be added as required, even at a later point.
-------------
PR: https://git.openjdk.org/panama-foreign/pull/775
More information about the panama-dev
mailing list