No segment method for MemoryAddress?

Ty Young youngty1997 at gmail.com
Thu Aug 20 20:32:44 UTC 2020


So, apparently the <MemoryAddress>.segment() method was removed and now 
provides a seemingly redundant address() method:


private final MemoryAddress address;


...


this.address.address();


which has the Javadoc:


"Map this object into a MemoryAddress instance."


...but it is already a MemoryAddress? What is going on here? How are you 
supposed to get a segment from an address? Why is there a seemingly 
redundant address() method?


Reading the Javadoc of Addressable:


"Represents a type which is addressable. An addressable type is one 
which can be projected down to a memory address instance (see 
address()). Examples of addressable types are MemorySegment, 
MemoryAddress, LibraryLookup.Symbol and CSupport.VaList."


provides context on why the address() method exists but not why 
segment() has been removed.


Personally, I think the address() method should be removed and the 
components that make up a MemoryAddress be exposed instead if possible, 
but that's my 2 cents.







More information about the panama-dev mailing list