kill the commas! (phobos code cleanup)

via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 7 07:08:30 PDT 2014


On Sunday, 7 September 2014 at 11:31:01 UTC, ketmar via 
Digitalmars-d wrote:
> oh, no, thanks. casting strings back and forth for slicing is 
> not fun.
> and writing parsers using string slicing is fun.

Uhm, why? For a parser you are generally better off padding the 
end with guards/sentinels and only move a pointer.

> or just ditch utf-8 and use ucs-4. this will speedup the most
> frequently string operations: correct indexing and slicing.

I almost never use indexing of strings.

I tend to use either comparisons, regexps, splitting into phrases 
or matching on the head or tail.

> the whole "let's use utf-8 as internal string representation" 
> was a mistake. and i'm not talking about D here.

Not if you want efficient I/O and want to conserve memory (which 
is what you want in a server).


More information about the Digitalmars-d mailing list