I want off Mr. Golang's Wild Ride

Walter Bright newshound2 at digitalmars.com
Sat Feb 29 05:50:16 UTC 2020


On 2/28/2020 8:54 PM, H. S. Teoh wrote:
> The most glaring point to me is Phobos' ubiquitous use of `string`
> everywhere for filenames. The fact that strings are assumed to be valid
> UTF-8 will almost certainly land us in the same complaints as the author
> had about Go's handling of pathnames.
>
> Changing that would be a major code breaker, though. So I'm not sure if
> we should even attempt to!

This is an interesting problem. I don't know about Rust, but in D a string's 
contents are not guaranteed to contain valid UTF-8. For the string algorithms 
I've worked on, I always made them to be tolerant of bad UTF, for the simple 
reason that bad UTF is everywhere and having the program aggressively halt on it 
is overkill. The only time validity is checked is when decoding is attempted, or 
*cough* autodecode *cough* is running, which I'd circumvent.

So I expect we are in good shape there.

Things we must specifically review, however, are:

1. the way stat is dealt with

2. the way file extensions are determined

3. the \ vs /

and more generally, follow the principles outlined in the article.


More information about the Digitalmars-d mailing list