Improvements to std.uni.sicmp and std.uni.icmp#4256
Improvements to std.uni.sicmp and std.uni.icmp#4256DmitryOlshansky merged 2 commits intodlang:masterfrom
Conversation
|
@wilzbach @Hackerpilot what's with the random travis error? |
|
std/uni.d
Outdated
| * By using $(XREF utf, byUTF) and its aliases, GC allocations via auto-decoding | ||
| * and thrown exceptions can be avoided. | ||
| */ | ||
| @safe nothrow pure unittest |
There was a problem hiding this comment.
Can't with string literals.
There was a problem hiding this comment.
Ehm.. They are static what's wrong with it?
There was a problem hiding this comment.
Huh, I guess you can add it. I thought that the rules about array literals applied to string literals.
Should be fixed once #4255 kicks in. Sorry about that :/ |
|
@DmitryOlshansky fixed |
|
LGTM |
|
Auto-merge toggled on |
| { | ||
| import std.utf : byDchar; | ||
|
|
||
| assert(icmp("Rußland".byDchar, "Russland".byDchar) == 0); |
There was a problem hiding this comment.
Wait what???
In German (my mother tongue) this is not guaranteed to be correct. From Wikipedia:
Thus it helps to distinguish words like Buße (long vowel) 'penance, fine' and Busse (short vowel) 'buses'.
There was a problem hiding this comment.
This is caseless comparison and follows rules of Unicode
There was a problem hiding this comment.
This is caseless comparison and follows rules of Unicode
Oh sorry. Overlooked from my phone :/
The main points:
sicmpwere completely wrong becausedecodecannot be called with forward ranges. In the future this could be made to work with forward ranges but for now this needs to be fixedicmpcan be@nogc @safe nothrow pureif used withbyUTF.icmp's docs