by Wowfunhappy · 1y ago · 0 comments
IMO, "Treat any sequence of digits as a number for the purpose of sorting" is consistent. I'm not sure if it's documented—I've never needed to look up the documentation—but if it's not, the developers could certainly fix that.
> this is your preference for a specific situation.
Sure, but we generally make decisions based on which situations we think will be most common. I think having ten or more things (screenshots, audio samples, whatever) named "Thing 1" – "Thing 10" in a folder is extremely common. And if Thing 10 comes before 9, it's really annoying!
Let's say I have a directory of 32 numbered files. Under the author's preferred sorting method, they'll get displayed:
1
10
11
12
13
14
15
16
17
18
19
2
20
21
22
23
24
25
26
27
28
29
3
31
32
4
5
6
7
8
9
If I download a folder with files like this, I basically have to pause whatever I'm doing and edit the files to have leading zeroes before I can make sense of what I'm looking at. 1
2
9
10
11
So I guess you also want things sorted like 1.1
1.2
2
9
9.9
And also 1
1.1
1.10
1.2
1.10.1
So when you're done defining whatever crazy rules you think up, how do I pause whatever and edit the filenames to get them back into lexicographical order?You can massage lexicographical to meet your needs. I can't massage your arbitrary rules to meet my needs.
1.10
1.2
or 1.2
1.10
?I would not know how an OS treats those if we do not assume mindreading vs proper lexicographic order. Why would we need to substitute precision with vagueness for something that simply taking care of proper naming would suffice?
If you have non-integer numbers in your filenames then it won’t give the order you want, but there isn’t going to be a rule that works for all cases.
Are you sure about that?
So how do you suggest handling hexadecimal numbers?
Or octal numbers?
What about binary numbers?
What about file names with portions of a date and/or time?
How is a program supposed to know any of the above?
> Let's say I have a directory of 32 numbered files.Assuming any of the filesystems I am aware of is in use, those names are strings having one or two characters. They are not "numbered files."
It just happens to be the most logical way to sort for computers too, as long as humans are involved in the usage of the data.
That would be great, but this ISO is just one of the standards, and there are still regional standards as well.
And that's still ignoring the end-user. In Europe for example, humans might create filenames with date in format dd.mm, e.g. "Report 25.01.xls"
A system attempting to sort this intelligently would likely assume this is a decimal number, as it has zero context for it.
It's just slightly worse than the lack of consistent UTC-usage of systems, with the mixed attempts to correct data to local timezone (or not) depending on application...
> those names are strings having one or two characters. They are not "numbered files."
Yes they are! In this context, a number is an idea, not a data type. Strings are capable of containing numbers.
However, for hex numbers this simply won't give good results because some of them will just happen to not contain any of the digits A to F and be treated as base-10 numbers by the heuristic while others will include these digits and be sorted differently.
(So, a having a strict lexicographic mode as an alternative in file managers would be nice.)
Op was taking about changing the rule to something more intuitive, in such case it would s'en natural that decimal numbers are used.
And what about very long strings of digits in the filenames - so long that they are too long for even the longest available numerical representation? In some apps, they are converted to floating point...
How about decimal numbers, are they strings or still numbers?
How about version numbers with multiple dots?
How about decimal numbers of a different locale, e.g. you list the folder from a remote machine with filenames of a different locale?
The problem with such semi-consistent schemes is that they are still guess-work, they may make some cases better for some people, but other cases practically unusable because the system doesn't have sufficient information to handle all scenarios consistently.