I'd like to propose the alternative that we just expose the byte-based underlying nature on all platforms, rather than trying to hide that.
People already widely rely on that, to the point that I don't think we could reasonably change it. We could go ahead and expose it, for convenience, and make OsStr
and OsString
as close as we can reasonably get them to BStr
and BString
.
(In an ideal world, I wish we could have BStr and BString, and separately have "OS string" types that weren't byte-based and matched the underlying platform, so that on Windows we didn't have to convert back-and-forth between WTF-8 and UTF-16. But our current stable API surface doesn't allow for that. There are some other improvements we might be able to make in that vein, though.)