On Fri, 21 Nov 2025 14:14:06 GMT, Jorn Vernee <[email protected]> wrote:
>> Liam Miller-Cushon has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Review feedback >> >> * handle numChars + srcIndex overflow, and add tests >> * replace yen with a character that round trips > > Latest version looks good to me. Left one last suggestion inline. > I think overall it makes sense -- I believe @JornVernee proposed something > similar in the past. It's true it's inconsistent with other `copy` method > and, in hindsight, it would have perhaps been useful to always return a > length (given that in other cases length is expressed in "elements" -- either > array elements, or elements expressed in a given layout) -- although in the > other cases the copy length can usually be computed using a shift operation. Also, I believe the need for returning a copy length is probably driven by the fact that we have dropped the `MemorySegment::ofString(String, Charset)` view that we originally anticipated. If we had that method, returning a length wouldn't have been as important -- although perhaps, to compensate fully, we would also have needed a view that took a char index and a char length -- e.g. to view a _substring_ as a memory segment. ------------- PR Comment: https://git.openjdk.org/jdk/pull/28043#issuecomment-3571270973
