6 ms·
I'm not sure I agree. I think I could be convinced if there was a unique and universal representation for numeric values using characters. But we have so many
by derriz 1y ago
I'm not sure I agree. I think I could be convinced if there was a unique and universal representation for numeric values using characters.
But we have so many textual representations of numeric values that I'm assuming the "mind-reading" goodness only works for a small subset. And the subset will be somewhat intuitive for developers but unlikely to be so for non-technical people.
For example, does the order handle numbers with fractions (decimal points)? If yes, does it require a at least one leading digit (zero)? Does a.12345 come before or after a.345?
Does it handle thousand separators? What about international thousand and decimal separators (e.g. Euro-style . for thousand separation and , for decimal separation).
Does it handle scientific notation?
If the answer is no to any of these questions, it's likely to lead to surprise/confusion.
It's like a feature request that initially sounds reasonable and useful but once you explore the requirements in detail you realize there are too many edge cases to be able to meet the request in a non-brittle way.
- queenkjuul 1y agoAre filenames likely to include those representations? I feel like probably not (can you even include commas in Windows filenames?) More to the point of the article--if you want things sorted by date, sort by date. I think most laypeople aren't looking at long CHAR1234_5678 filenames anyway, they're looking at thumbnails and dates.
- mulmen 1y ago> can you even include commas in Windows filenames? Yes. > Use any character in the current code page for a name, including Unicode characters and characters in the extended character set (128–255), except for the following: The following reserved characters: < (less than) > (greater than) : (colon) " (double quote) / (forward slash) \ (backslash) | (vertical bar or pipe) ? (question mark) * (asterisk) https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file?utm_source=chatgpt.com https://learn.microsoft.com/en-us/windows/win32/fileio/namin...
- derriz 1y agoThe most common date format used in Europe uses period separators so can often appear in filenames. Commas are probably more rare. Things like versions are often fractional like v1.3 or v1.11 and can appear embedded in filenames.
- ongy 1y agoThat's not fractional though. Proper fractional, 1.11 is smaller than 1.3. In versions, 1.11 is larger than 1.3
- crazygringo 1y ago> if you want things sorted by date, sort by date Unfortunately it doesn't work. When I copy the files, they all get new dates in whatever random order they happened to be copied in.
- coldtea 1y agoAh, the classic filenames with decimal points and scientific notation in them, so common...
- II2II 1y agoHere's a different scenario: filenames with dates in them. Consider September Budget and October Budget. September is the equivalent of 9, October of 10. Which comes first for natural sorting? Remember, the file modify date may not be useful here since you may have wrapped up the September budget on October 1st while the prior edit to the October budget may have been on September 20th. The problem is that there is no such thing as natural, and it is quite hard to determine what is more common. (Quite often more common is culturally dependent or, worse, contex dependent).
- arccy 1y agothe one true way: budget_09.csv, budget_10.csv
- NekkoDroid 1y agoThen `budget_100.csv` comes by and now you need to rename 99 files.
- xigoi 1y agoIt’s been about two thousand years since the number of months in a year has been increased. I don’t think we’re getting 88 new ones anytime soon.
- thaumasiotes 1y ago> It’s been about two thousand years since the number of months in a year has been increased. What? What are you thinking of? The number of months in a year is always 12 or 13 in any calendar system because they start by reflecting the moon. If you mean the Christian calendar, it was fixed at 12 months to the year well over 2000 years ago. If you mean any calendar, it's probably been more like one year since the number of months in a year has been increased. 12 lunar months falls short of a solar year by about 11 days, so any given lunar calendar will generate an extra month about every three years, and there are lots of different lunar calendars. (For example, the Chinese calendar occasionally repeats full months in order to keep the month of the year lined up with the season. Whenever this happens, there will be 13 months in the year, of which two share the same name.)
- Certhas 1y agoThe sort rules are simple (1). Treat any consecutive sequence of digits as a number when sorting. So for example version numbers (which must be massively more common than decimals in filenames) work correctly, and 5.9 is indeed smaller than 5.10 and the latter is not identical to 5.1 . Given that this idea goes back more than two decades, has been the default behaviour of the most used OSes for many years, with no major outcry, I think empirically we can be fairly certain that it does not routinely lead to a lot of surprises and confusion. (1) https://en.m.wikipedia.org/wiki/Natural_sort_order https://en.m.wikipedia.org/wiki/Natural_sort_order
- xigoi 1y ago> Treat any consecutive sequence of digits as a number when sorting. Based on this description, I have no idea how the following would be sorted: • photo.jpg • photo1.jpg • photo01.jpg • photos.jpg
- crazygringo 1y agoDoes it matter? There's a user expectation that photo20.jpg comes after photo3.jpg. There's no user expectation around whether photo1.jpg or photo01.jpg comes first. Just like there's no user expectation around whether photo1.jpg or Photo1.jpg comes first. Users also don't have the slightest idea about what order punctuation gets sorted in. Just sort the things that matter in the way users expect (natural sort order) and come up with something reasonably consistent for the rest.
- kiitos 1y ago> There's a user expectation that photo20.jpg comes after photo3.jpg. my user expectation is the opposite i get what you're saying but it's not achievable in practice, at least not consistently
- pixl97 1y agoIt sounds like a problem with too many expectations therefore someone will be disappointed.
- systoll 1y agoThe entire idea that numbers would be treated on a character by character basis rather than as numbers is somewhat intuitive for developers and not for non-technical people. The answer to all of those questions is no for lexicographic ordering. Lexicographic ordering leads to surprise and confusion as a result. > It's like a feature request that initially sounds reasonable and useful but once you explore the requirements in detail you realize there are too many edge cases to be able to meet the request in a non-brittle way. It's been on windows and macOS for coming up on 25 years, and is in practically every modern UI. It’s reasonable.
- ori_b 1y ago> If the answer is no to any of these questions, it's likely to lead to surprise/confusion. Worse, if the answer is yes to any of these questions, it's also likely to lead to surprise/confusion. The only way to win is not to play.
- tobyjsullivan 1y agoThere is a standard algorithm - CLDR collation. There are several options available but, generally speaking, it’s a standard. The specific option for numeric sorting is “kn”. As far as I can tell, every operating system and many other interfaces tend to use this standard algorithm. https://www.unicode.org/reports/tr35/tr35-collation.html#CLDR_Collation https://www.unicode.org/reports/tr35/tr35-collation.html#CLD...