[foreign-memaccess+abi] RFR: 8264515: Rename static factory methods in the foreign API [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Wed Mar 31 16:44:26 UTC 2021


On Wed, 31 Mar 2021 16:32:12 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

> Very good.
> 
> Something to ponder after this PR. I have my suspicion that the distinction with the "of" naming convention will be lost on many as such methods get swept up in the `static import ...SegmentAllocator.*`. It may be better to be simpler (less nuanced) and consistent.

True - that's why we conceded for ofXYZ - e.g.

toCString("Hello", ofScope(scope))
Which is not ideal, but not downright terrible.

The alternative would be to have `prefixAllocator` and `scopedAllocator` - we considered that and went against that (at least for the time being) as they suggest that these allocators are really more than what they really are. E.g. when I create an arena allocator, there's some work going on - whereas for scope/segment -> allocator is really just wiring up things. The distinction is subtle, yes, but I'd like to see how much mileage we can get :-)

-------------

PR: https://git.openjdk.java.net/panama-foreign/pull/487


More information about the panama-dev mailing list