Difference between revisions of "Element type of string ranges"
m (→Comparison) |
|||
Line 32: | Line 32: | ||
|rowspan=2| {{No}} Fails silently. | |rowspan=2| {{No}} Fails silently. | ||
|rowspan=2| {{No}} Will emit a warning or fail to compile | |rowspan=2| {{No}} Will emit a warning or fail to compile | ||
− | |rowspan=2| This should not be recommended practice (correct case conversion and comparison for all languages is more complicated, and depends on locale - e.g. Turkish I / ı and İ / i). | + | |rowspan=2| This should not be recommended practice (correct case conversion and comparison for all languages is more complicated, and depends on locale - e.g. [http://en.wikipedia.org/wiki/Dotted_and_dotless_I Turkish I / ı and İ / i]). |
|- | |- | ||
! Case conversion, insensitive comparison in ranges for other languages | ! Case conversion, insensitive comparison in ranges for other languages |
Revision as of 16:23, 9 March 2014
This article attempts to summarize the arguments in the thread Major performance problem with std.array.front().
Comparison
One of the proposals in the thread is to switch the iteration type of string ranges from dchar to the string's character type.
Argument | Current behavior (code point iteration) |
Code unit iteration | Code unit iteration + forbid implicit char <=> dchar conversions | Notes |
---|---|---|---|---|
Status quo | ![]() |
![]() |
![]() | |
![]() |
![]() | |||
Searching for a particular dchar in a string. | ![]() |
![]() |
![]() |
This should not be recommended practice (not all languages have notions of characters, and not all characters (glyphs/graphemes) can be represented in one dchar). |
Searching for a particular dchar in a non-normalized string. | ![]() | |||
Case conversion, insensitive comparison in ranges for certain languages | ![]() |
![]() |
![]() |
This should not be recommended practice (correct case conversion and comparison for all languages is more complicated, and depends on locale - e.g. Turkish I / ı and İ / i). |
Case conversion, insensitive comparison in ranges for other languages | ![]() | |||
Correctness | ![]() |
![]() |
![]() | |
Performance | ![]() |
![]() | ||
Implementation difficulty | ![]() phobos/std $ grep ElementEncodingType *.d | wc -l 80 |
![]() | ||
Consistency | ![]() ![]() |
![]() |