No we should not support enum types derived from strings

guai guai at inbox.ru
Sat May 8 21:47:21 UTC 2021


On Saturday, 8 May 2021 at 20:22:28 UTC, Jon Degenhardt wrote:
> If all an algorithm needs to do is split a string roughly in 
> half, then use the byte offsets to find the halfway point and 
> then look for a utf-8 character boundary. If the algorithm is 
> based on some other boundary, say, token boundaries, then find 
> one of those boundaries.

Those algorithms you talking about are either doesn't need 
strings at all but instead byte/char arrays or would produce 
garbage for any input other than ascii.
Your example with log files mixes binary data with text. Properly 
done logger will escape delimiters inside text chunks, so it 
isn't even a string per se, it's some binary data from which you 
need to extract a string first.
A lot of bugs are caused by this mixing of text with binary. And 
I think it is better to distinguish them properly on a type level.


More information about the Digitalmars-d mailing list