3 ms·
Author here: I've spent about half a decade writing Win32 applications, including things deep in NTFS. I agree completely that everything about string typing o
by woodruffw 7y ago
Author here: I've spent about half a decade writing Win32 applications, including things deep in NTFS.
I agree completely that everything about string typing on Windows is worse, especially once you stray off of the happy path. But the post isn't intended to equivocate against a ecosystem with 40 years of legacy APIs in it; it's to nitpick a new ecosystem that I otherwise love ;)
- DrBazza 7y agoAgreed. Abstracting the OS and its different string versions is hard. Even more so when your language has to work on multiple OSes. And then add into the mix non-mutable by default. This blog post [1] may interest you (if you haven't already read it). [1] https://fasterthanli.me/blog/2020/i-want-off-mr-golangs-wild-ride/ https://fasterthanli.me/blog/2020/i-want-off-mr-golangs-wild...
- eska 7y agoI don't see an alternative to interfacing with that though. If we were to just use UTF-8 strings for everything then there would be files we couldn't handle in various OSs for example. So while it's a bit unwiedly to use filepath.to_lossy_str() etc. I prefer it to a leaky abstraction that hides necessary complexity.
- jcranmer 7y agoIt wouldn't be an issue if OSes forbade non-UTF-8 paths... It's the unfortunate case that we have OS environments that are usually, but not always, UTF-8, and there's no clear, reliable indication of whether or not UTF-8 is to be expected.
- DrBazza 7y agoAnd this was the other article about Rust strings I meant to link: https://fasterthanli.me/blog/2020/working-with-strings-in-rust/ https://fasterthanli.me/blog/2020/working-with-strings-in-ru...