4 ms·
> IMO, "Treat any sequence of digits as a number for the purpose of sorting" is consistent. Are you sure about that? So how do you suggest handling hexadeci
by AdieuToLogic 1y ago
> IMO, "Treat any sequence of digits as a number for the purpose of sorting" is consistent.
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."
- ewidar 1y agoI am not sure any of the points you raised change anything to the OP's point, do they? Op was taking about changing the rule to something more intuitive, in such case it would s'en natural that decimal numbers are used.
- Moru 1y agoSorting dates: This is why there is an international standard of having YYYY-MM-DD hh:mm:ss in the order we have it. We got to learn this in school in the 80-ies because sorting paper documents would be more logical and easier to find stuff. So way before most people got computerized. 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.
- rickdeckard 1y ago> Sorting dates: This is why there is an international standard of having YYYY-MM-DD hh:mm:ss in the order we have it. 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...
- Wowfunhappy 1y agoOkay, I'll refine the rule to "Treat any sequence of digits as a base 10 whole number for the purpose of sorting". I still think this is quite clear. (Frankly, I also think the original definition is quite clear unless you're purposefully trying to misinterpret it.) > 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.
- Skeime 1y agoI generally agree that treating substrings that are numbers as numbers is a good default for most users in most situations. 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.)
- mnw21cam 1y agoOctal or binary numbers are going to be fine, but it'll totally and confusingly mess up hexadecimal numbers.