Thread overview
[Issue 20483] std.uni.byGrapheme & Grapheme.opSlice requires obscure REF parameters.
Jan 06, 2020
Alex
Dec 17, 2022
Iain Buclaw
January 06, 2020
https://issues.dlang.org/show_bug.cgi?id=20483

Alex <sascha.orlov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sascha.orlov@gmail.com

--- Comment #1 from Alex <sascha.orlov@gmail.com> ---
for the sake of completeness https://forum.dlang.org/thread/qu5et2$1f0h$1@digitalmars.com

--
January 08, 2020
https://issues.dlang.org/show_bug.cgi?id=20483

hsteoh@quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh@quickfur.ath.cx

--
January 08, 2020
https://issues.dlang.org/show_bug.cgi?id=20483

--- Comment #2 from hsteoh@quickfur.ath.cx ---
The problem is caused by the implementation of Grapheme.opSlice(), which returns a proxy range object that contains a pointer to the parent Grapheme.  A cursory glance at the code didn't show any obvious reason why this was done this way; conceivably the proxy object returned by .opSlice could just copy the necessary data from Grapheme instead of retaining a pointer to it.

This implementation choice makes it hard to work with Graphemes in range-based pipelines. If anywhere in the pipeline a Grapheme is generated on-the-fly, it will generally be returned from .front as an rvalue, and therefore even the ref trick mentioned in this bug will no longer work.

I recommend to change the implementation of .opSlice so that it does not retain a pointer to the parent Grapheme.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=20483

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--