[foreign-memaccess] [Rev 01] RFR: Add MemorySegment::fill
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu May 14 21:03:02 UTC 2020
On 14/05/2020 21:50, John R Rose wrote:
> If a MS has a utility method for sending data somewhere else, it shouldn't
> be called `copy` but rather `copyRange` (as in ju.Arrays) or `copyOut`
> or `copyTo`. I have a very mild preference for `copyFrom` for the normal
> polarity of a copy, which copies into the receiver, but that would tend to
> drag in `fillFrom` or `fillWith`, which looks like overkill.
Agree - in my comment I think I specifically used `copyTo` and the
argument was the destination. `copy` becomes ambiguous if we use the
instance method style. `copyRange` seems similarly ambiguous. So, for me
it's either `copyFrom` (receiver is the destination) or `copyTo`
(receiver is the thing you want to copy onto the other segment).
I'm not too worried that other methods don't have suffixes, since they
are not ambiguous. Consistency is important, but I think it's one aspect
of the decision. The most important aspect is how readable the code is.
And I think we have made some strides in this discussion to make some
improvements on that front.
More information about the panama-dev
mailing list