The Case Against Autodecode

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Mon May 30 11:26:32 PDT 2016


On Monday, 30 May 2016 at 17:14:47 UTC, Andrew Godfrey wrote:
> I like "make string iteration explicit" but I wonder about 
> other constructs. E.g. What about "sort an array of strings"? 
> How would you tell a generic sort function whether you want it 
> to interpret strings by code unit vs code point vs grapheme?

The comparison predicate does that...

sort!( (string a, string b) {
   /* you interpret a and b here and return the comparison */
})(["hi", "there"]);


More information about the Digitalmars-d mailing list