On Sep 20, 2013, at 1:13 AM, Masklinn <maskl...@masklinn.net> wrote:

>>> Also,
>>> 
>>>> windows file paths
>>> 
>>> windows paths can also use forward slashes so that's not a very
>>> interesting justification.
>> 
>> Not always. UNC paths must start with \\ (in my testing, //foo/bar/baz is 
>> not interpreted as a UNC path by the Windows File Explorer, but 
>> \\foo/bar/baz is).
> 
> True. Do you expect writing literal UNC paths in Rust to be a common 
> occurrence?

Maybe not for most people, but I've been writing them a _lot_ lately (I'm 
rewriting the path module).

Regular expressions is really the most common application here.

>> There's also paths that start with the verbatim prefix \\?\, which disables 
>> interpretation of forward-slashes (among other things).
> 
> That's not really relevant to a rawstrings proposal, why would a
> developer embed such a path literally?

Perhaps they want to hard-code a path that refers to something that requires 
the \\?\ prefix (such as a path that contains / as part of a path component, or 
is longer than 255 characters).

But just in general, \ is the canonical Windows path separator. I don't think 
"use /" is particularly great advice. What if this string is intended for 
displaying?

>> As I am actively engaged in writing a replacement for the path module, and 
>> am currently expanding the test suite for Windows paths, raw strings would 
>> be extremely useful to me.
> 
> I'd have thought it a better idea to use path builders (maybe macros)
> and avoid embedding literal path separators in order to avoid
> portability issues.

People still use literal path separators in strings all the time in languages 
that support path-building methods.

-Kevin
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to