[Issue 23361] std.uni.normalize should be pure
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Oct 30 22:50:27 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23361
Imperatorn <johan_forsberg_86 at hotmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |johan_forsberg_86 at hotmail.c
| |om
--- Comment #1 from Imperatorn <johan_forsberg_86 at hotmail.com> ---
I took a look at this.
If you mark the following as pure:
normalize
decompose
decomposeHangul
Then there's only this that needs to be pure (in normalize)
() @trusted {
decomposed.assumeSafeAppend();
ccc.length = 0;
ccc.assumeSafeAppend();
} ();
To cheat and not make the appenders pure but the block pure we can just add
pure:
() @trusted pure {
decomposed.assumeSafeAppend();
ccc.length = 0;
ccc.assumeSafeAppend();
} ();
But, we still need some way there to allow calling the impure append from the
pure block.
Maybe we could cast some function pointer to pure, I don't know.
I tested wrapping it in a debug block and that makes it work, but I'm not sure
what the "real" solution would look like.
() @trusted pure {
debug {
decomposed.assumeSafeAppend();
ccc.length = 0;
ccc.assumeSafeAppend();
}
} ();
--
More information about the Digitalmars-d-bugs
mailing list