-
-
Notifications
You must be signed in to change notification settings - Fork 747
Improvements to std.uni.sicmp and std.uni.icmp #4256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add nogc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't with string literals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ehm.. They are static what's wrong with it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is caseless comparison and follows rules of Unicode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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