1369
D or d come on (i.imgur.com)
submitted 7 months ago by [email protected] to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 22 points 7 months ago

I don't get it... "D" is a complete different character than "d" is.

It's like wondering why "file1" is not opened when I typed in "file2".

[-] [email protected] 20 points 7 months ago

that's not how language works though, in human language (i know this can be confusing) d and D are the same letter just in different forms.

It's one thing to have case sensitivity in programs doing data manipulation, that makes sense because you don't want the program to accidentally use the wrong files without supervision.

But when you have an interactive prompt you know what you're doing, you can see if you entered the wrong directory, and you're generally going to be working in directories that you have yourself organized.

[-] [email protected] 0 points 7 months ago

Doesn't tab completion solve this if there are no alternatives with matching case? sounds like a PBKAC

[-] [email protected] 8 points 7 months ago

You could also say that down should not complete to download since those are completely different strings and you shouldn't expect one to get you the other.

[-] [email protected] 3 points 7 months ago

Sorry, down is a substring of download I don't get your point either?

[-] [email protected] 2 points 7 months ago

Substring is not string.

If they were interchangeable, then "D" & "d" should be too.

[-] [email protected] 1 points 7 months ago

down matches down* because * also includes empty string. Also download matches down*

D matches D* but d is not matching D* because D is a different character than d.

[-] [email protected] 1 points 7 months ago* (last edited 7 months ago)

but why do we have to match specifically against substr*? it's not a law of nature, we could also match against the regex (?i)substr(?-i).*

not saying that one option is necessarily better, but I don't see a good reason for which any one of these options would be terrible

[-] [email protected] 1 points 7 months ago* (last edited 7 months ago)

Because usability. If you have the files down down1 down2 downxyz and download and the user only knows that it was "something with down" it's best to show the user everything matching "down*" and let the user decide what's the correct one.

Also I'm not sure but wouldn't your expression show everything if only one character would be entered?

And again I don't see this solving anything if the entered string actually contains other characters then what's in the file (D != d)

Yes one could argue that some form of advanced algorithm or even AI could be used to identify such use case like download and Download but this is programming Humor, not linguisic Humor.

[-] [email protected] 1 points 7 months ago

would it not be usable to have completion be case insensitive? I seem to be able to use that... if I only remember "something with down", I could just as easily forget the capitalization of "down". maybe I have downloads and Down? why not show everything matching case insensitively and let the user decide what's the correct one?

I didn't really understand what you thought the regex did incorrectly, but I think the regex works fine, at least for most implementations, anyways what I meant is just a case insensitive version of the regular substring completion, which shouldn't be too difficult to make.

The only thing it solves is the frustration of having to look for a file/directory twice because you didn't remember it's capitalization. again, those are different characters just like a do and downloads are different strings, but it can be easier for users if they can just press tab and let the computer fill the part of the name the don't remember (or don't want to type).

you don't need an advanced algorithm or and AI, there are many easy ways to make completion case insensitive (like that regex for example). Issues involving names are inherently somewhat linguistic, but either way interactive shells are meant to be (at least somewhat) usable to humans, and as seen by the post, some people would prefer completion to be case insensitive.

[-] [email protected] 8 points 7 months ago

On Windows filenames are case insensitive at least usually, some people are used to that. But that is poor design for so many reasons, Turkish I being one of them.

[-] [email protected] 11 points 7 months ago

Now take Android. Files are case-sensitive yet you can't create 2 files with same name if they only vary in case.

[-] [email protected] 1 points 7 months ago

TIL, thanks. I wonder why they chose to do it this way.

[-] AnUnusualRelic 1 points 7 months ago

They cater to windows users that are used to the quirks of their broken system.

[-] [email protected] -2 points 7 months ago* (last edited 7 months ago)

People want their computers to magically know what they want these days. :)

This specific problem doesn't exist in oh-my-zsh config though. It will find the directory even if spelling it like this.

[-] [email protected] 4 points 7 months ago

“magically know what they want” aka occasionally set you and your files on fire

i prefer not fire

this post was submitted on 02 Oct 2023
1369 points (96.7% liked)

Programmer Humor

17661 readers
572 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 11 months ago
MODERATORS