String front, back return code point/unit

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Jun 23 16:20:24 UTC 2021


On Wed, Jun 23, 2021 at 04:01:24PM +0000, vit via Digitalmars-d-learn wrote:
[...]
> My question is not about ranges/iterators but if is good idea
> autodecoding custom string or not.

No.  Autodecoding is one of the decisions we regret because it
introduces an unavoidable overhead on basically every string operation
in Phobos.

Autodecoding was introduced under the misunderstanding that code point
== grapheme, but unfortunately that is false.  So it fails to accomplish
its original purpose and on top of that introduces a performance
problem.  To accomplish its original purpose would require grapheme
decoding; but unfortunately that introduces an even worse performance
overhead (Unicode grapheme decoding is non-trivial).

tl;dr: don't do it.


T

-- 
Why are you blatanly misspelling "blatant"? -- Branden Robinson


More information about the Digitalmars-d-learn mailing list