Additional mismatch overloads for memory segments

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Tue Jun 14 12:40:17 UTC 2022


On 14/06/2022 13:03, Alexander Biryukov wrote:
> That makes sense, and I think your description pretty much sums it up.
> Maybe it can be transformed in a checklist:
>
> 1. Instance methods are preferred
> 2. Binary operators are implemented as static and instance methods, 
> both with offsets
> 3. Some instance methods have offset-related overloads, where it makes 
> sense
> 4. Pure static methods are not welcome, except for some widespread 
> patterns, like factory methods (*)

I would split (3) as follows:

3a. Instance methods have an additional offset parameter
3b. Where it makes sense, offset-free overloads might be provided (e.g. 
call method in (3a) with offset=0)

This feels more principled, as (3a) is a primitive and (3b) is sugare 
than can easily be derived from that.

Re. your point of using analytics, again, this is a relatively new API, 
there's not much code using it out there, so the risk of "overfitting" 
is real.

I'm slightly on the fence w.r.t. having both static and instance 
variants for binary methods - that said, as long as we can clearly 
explain what's the primitive (the static method), I think the API can 
still be explain in a relatively straightforward fashion.

Maurizio





More information about the panama-dev mailing list