3 ms·
> It took a bit to wrap my head around this when I first read about it[0], but now that I think about it, I think it's the right way to go[1]. I don't actually
by pcwalton 13y ago
> It took a bit to wrap my head around this when I first read about it[0], but now that I think about it, I think it's the right way to go[1].
I don't actually think it's the right way to go: I'd prefer if strings enforced that they were UTF-8. That saves a lot of error checking by clients that consume it and want to be defensive. It's most efficient to have the type system do the work.
- andreasvc 13y agoSo how do you then deal with problem in the original blog post: a filename that is a non-UTF8 byte string? Surrogates? A separate byte string type?
- pcwalton 13y agoUse a separate byte string type. The problem is that paths are not UTF-8. That's a fixable problem: just let the type system know about it.