5 ms·
What does the merit of spaces in file names matter? You still will need to deal with files with spaces in the real world. If your tooling doesn't support it, it
by debaserab2 9y ago
What does the merit of spaces in file names matter? You still will need to deal with files with spaces in the real world. If your tooling doesn't support it, it's a non-starter for many.
- hzhou321 9y agoWhat about real world is that in real world, it is not context-free. There are real world situations -- such as selling a word processor to general public (especially) including clueless -- you need to deal with files with spaces, period. But there are real world situations -- such as Makefiles -- requires users to learn the tool, to be able to handle certain tricky situations themselves and excludes incompetents. And then there are real world situations that the application only concerns within a company, or within an office, or within one-self. What about real world is, it is complicated.
- to3m 9y agoI'm bemused by this repeated insistence that supporting spaces in file names is somehow difficult.
- JustSomeNobody 9y agoThe word was complicated, not difficult. It is not difficult to handle spaces, it is more complicated.
- to3m 9y agoThat's a worthwhile clarification - thank you. While that's certainly true in the strict sense, I remain bemused.
- scbrg 9y agoI'm bemused by this repeated insistence that supporting colon in file names is somehow difficult.
- deleted 9y ago[deleted]
- to3m 9y agoWho on earth insists that? Only Windows programmers, I expect! But it's easy: make sure they're expressible in your syntax, then pass them through as part of the file name. Just like spaces. If there's a problem, you'll get an error back from the OS.
- scbrg 9y agoYes, of course you're right. My apologies, it was a stupid comparison. Though I still feel it's a bit of "choose your poison". In any language, certain symbols will have special meaning. You pretty much have to pick which ones, and come up with rules about how to let their natural meaning bleed through. With unix shells, one such character is the space, and there's a number of rules about how to let their natural meaning bleed through - but they're all somewhat awkward, and they all need special care.
- gonvaled 9y agoAnd nulls? And quotes? And dollars? And any unicode char?
- to3m 9y agoI expect you mean NUL (ASCII 0) - but that's typically not a good choice, because POSIX decrees it invalid, along with '/'. But anything else is fair game, sure. Handling every Unicode char might be a pain, but that's the filing system's job, not yours! Most programming languages manage to get this right. You have a quoting syntax with an escape character that lets you express the quotes, the escape character, and any arbitrary character (as a byte sequence, as a Unicode codepoint in some encoding, etc.) as well. Now you can do everything. Why not do this? I'm not going to say this won't be a pain if you decide to write out every file name possible, because it will be, inevitably. But you can supply alternative syntaxes by way of more convenient (if limiting) shorthand - Python has its r"""...""" notation, for example, allowing you to express the majority of interesting strings without needing to escape anything. You might argue that I've just punted the problem on to the text editor and the filing system. You'd be quite right.
- gonvaled 9y agoDepends very much on your programming environment: on Python I don"t care, but when doing bash scripting or makefiles (very often) I very much care. I have recently decided to stop using $ in passwords (defined by me) for that same reason: of course they are valid char, but they are such a big pain to support in usual contexts that it is simply not worth it.
- gonvaled 9y agoAnd regarding slashes: are you bemused that unix does not support them in filenames? (Thanks for correcting the nul reference)
- to3m 9y agoNo, not really - I have no particular opinion about what POSIX chooses to support or not. But I'm going to go back to my original point. What I do have an opinion about is how reasonable it is for tools not to support a character that is valid in file names, when that character is straightforward to support with everyday, well known syntax. And when that character is ' ', the standard English word separator, as straightforwardly supported by approximately ever kind of quoting or escaping syntax ever, my opinion about a lack of support is: it's crap.
- oblio 9y agoYou’re trying to “sell” make. It is lacking a feature many of its competitors have. That’s a tough sell :)
- gonvaled 9y agoYour tools support filenames with tabs? With any unicode char? A real world possibility.
- talaketu 9y agoworks in bash: > touch "with<Ctrl+v><Tab>tab"
- gonvaled 9y agoExactly as easy as without tabs. Now do that the whole day, sometimes with tabs, sometimes without.
- kuschku 9y agoEvery project I develop is unit tested with strings containing invalid unicode text, containing null bytes, and other random stuff. If a user can’t paste any byte sequence, and expect it to work, then the tool is broken. I handle these cases.
- gonvaled 9y agoYou can do it. The question is whether you should if you can avoid it. When writing a shell script or makefile to deal with repetitive tasks if is easier to assume some things.
- yorwba 9y agoI'd prefer it if the writer of the shell or make didn't make too many assumptions about my assumptions. Even bash lets you escape unusual filenames for when you need them. Make will always explode your strings, and doesn't even attempt to let you escape them. I don't think it's unreasonable to expect a time-tested Unix tool dealing with files to actually handle all possible files.
- gonvaled 9y agoSo in order to deal with the real world possibility of spaces in filenames you choose to ditch a real world, useful tool? Perfectly reasonable if spaces in filenames are a hard req. In lots of scenarios they are not, and I prefer to assume that filenames have no spaces, and stick to make.