4 ms·
Why is / better than \ ?
by mardifoufs 3y ago
Why is / better than \ ?
- OsrsNeedsf2P 3y agoApart from the fact \ is used as an escape sequence?
- Alupis 3y agoFor starters, `\` is used for escape sequences for just about everything... meaning you now have to do the `\\` dance everywhere you need to write this path separator. Yes, it's true modern languages have things like `Path.separator` and stuff to abstract this away, but you cannot always use them in all contexts. It's small friction that adds up to a sore bum after a while...
- Joe_Cool 3y agoThe real fun starts with UNC paths. Is it `\\\\server\\share\ with\ space` or `//server/share\ with\ space` or any combination of those, preferably with quotes.
- saurik 3y agoFWIW, I have never wanted to put a \ in a filename, but I have often wanted to put a / in a (pretty) filename, as / is used in standard English all the time; I then find myself using "-" instead and that makes me unhappy. I'd much rather have seen ^ as the escape character and \ as the path separator.
- hollerith 3y agoYou can put slashes in filenames in MacOS's Finder app. If you use ls to view the filename, you'll see colons where Finder shows slashes.
- tracker1 3y agoWant to really mess with someone, do that on a mac file share on a windows server... You won't be able to do anything to that file or directory from Windows. Not sure if it's still an issue, but definitely was in the NT4/Win2k days.
- saurik 3y agoYeah, because Mac used to : as the separator... but, : is also an extremely commonly-used character that I have off wanted to put in a filename.
- jz391 3y agoCould be worse of course: Multics (the first system with hierarchical names) used greater-than (>) as separator. Unix/DOS use of slashes gives us the sane pipeline/redirection syntax we all love (see [1] for the Multics redirection syntax). [1] https://retrocomputing.stackexchange.com/questions/7030/why-did-unix-use-slash-as-the-directory-separator#answer-7031 https://retrocomputing.stackexchange.com/questions/7030/why-...