Live data from Hacker News

When I say “alphabetical order”, I mean “alphabetical order”

sebastiano.tronto.net

271–280 of 385 posts

Re: When I say “alphabetical order”, I mean “alphabetical order”

#271

Earlier quoted context omitted.

> Display strings in a consistent, documented, manner. 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…

> 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…

Sorting 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.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#272
post #90

Earlier quoted context omitted.

Here'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 n…

> 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 Yeah, but there is such a thing as "give a predictable and consistent way I can…

Budget 2025-09.ods and Budget 2025-10.ods would sort reliably.

The options explode infinitely if you start trying to guess what people want in terms of semantic grouping. One user might want to see "September Budget" beside "September Sales Projections" and "September Calendar", and another might want to group it with "October Budget" and "November Budget".

If you have simple, stupid, but predictable tools, people can work around that, by picking naming conventions and even directory groupings that achieve what they want.

The worst is when you have an enforced sort that's not what you want. I think in Windows now, even if you say "Sort by name" in the Downloads directory, it insists on sub-grouping by age. I want every version of the Foobaz spec I downloaded, and no, I don't remember if all of them were in the last 3 months!

Re: When I say “alphabetical order”, I mean “alphabetical order”

#273

Earlier quoted context omitted.

Agreed.What's more, the idea that people learn to put leading zeros is wrong and impractical, unless you know in advance how many digits you need. When you go from version 5.9.17 to 5.10.0 you don't go back and relabel every existing folder as 5.09.17. The today standard way of sorting is well defined, unambiguous, and natural. Lexographic has its place, but user facing interfaces ain't it.

Had this in the Beat Saber mod manager recently. The game released 1.40.10 and my mod manager suddenly thought that game went backwards from 1.40.9

I had a similar fun problem with a little tool for use with an ATSC TV tuner.

For context, while NTSC program selections were typically indexed by channel ("ABC here is channel 4, NBC is channel 6"), ATSC uses "subchannels" like "12.1" or "21.5". I had assumed these could be safely stored as a decimal type.

Then one of the broadcasters here introduced both "42.1" and "42.10" and it broke the key model in the underlying SQLite database I kept the channel info in.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#274

TLDR: the author found out about natural ordering [0], i.e. treating a sequence of digits as a number while sorting. Usually preferable, except when not. Just like distinguishing between upper- and lowercase letters, and other misery. [0] https://en.wikipedia.org/wiki/Natural_sort_order

> Usually preferable, except when not. Just like distinguishing between upper- and lowercase letters

When would it be preferable to distinguish between capital and lowercase letters?

Wiktionary does it religiously, and it always makes the entries worse. Want to know what something means in German? Well, that's on a separate page.

Do you want to look something up while using your phone? Don't be stupid; use a desktop that won't autocapitalize the first letter you type in.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#275
post #257

I agree with Microsoft/Google/KDE's order. The author's situation is extremely rare, and the situation where someone wants "10" to be before "9" is far more common. Moreover, desktops don't label this sorting "alphabetical" (E: and it would really be "lexicographic"*), they label it "by name" (an informal criteria), so technically they're not lying. > I miss the time when computers did what you told them to, instead…

> I agree with Microsoft/Google/KDE's order. I don't. I want string sorting to be string sorting. Filenames are strings. I wouldn't mind if there was an option to tell the file manager to do this "wrangle numbers out of strings and treat them as numbers" thing--so that I could turn that option off, and others who want that behavior could turn it on. But for this to be the default, without even a way to change it (exc…

I generally agree with your points (and love TDE) but

> I don't use autosave either. I don't want the computer to assume when I want to save a file. The computer is too stupid to know that.

That’s why, with auto save systems, you flag/name a version as your canonical save point.

Rather like a video game, I’d rather have the autosaves and not need them, because I generally save the game myself, than not have them at all.

A computer can be helpful and obedient at the same time, when it’s done correctly and puts the user in control.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#276
post #130

Earlier quoted context omitted.

No Just no User interfaces that try to be cleaver are a pita. Keep it simple, and avoid the confusion with corner cases that otherwise will baffle users. Like this

Lexicographic order is great when you need an unambiguous criterion that will work the same in every implementation; but you only need that for automated processing, i.e. for coding. For user-facing presentation, having 5.9.xxx before 5.10.xxx is simpler; the corner case that baffles users is having 5.1 and 5.10 before 5.2.

Some (most) systems will sort 5.9 after 5.10 though, so if the user is baffled they'll need to learn it anyway. Adding a second way to do it kinda makes things worse

Re: When I say “alphabetical order”, I mean “alphabetical order”

#277
post #10
post #2

https://www.unicode.org/reports/tr10/#Contextual_Sensitivity : “There are additional complications in certain languages, where the comparison is context sensitive and depends on more than just single characters compared directly against one another, […] Numbers. A customization may be desired to allow sorting numbers in numeric order. If strings including numbers are merely sorted alphabetically, the string “A-10” co…

But -10 is smaller than -2, right?

That's a hyphen, not a minus sign, silly.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#278

TLDR: the author found out about natural ordering [0], i.e. treating a sequence of digits as a number while sorting. Usually preferable, except when not. Just like distinguishing between upper- and lowercase letters, and other misery. [0] https://en.wikipedia.org/wiki/Natural_sort_order

> Usually preferable, except when not. Just like distinguishing between upper- and lowercase letters When would it be preferable to distinguish between capital and lowercase letters? Wiktionary does it religiously, and it always makes the entries worse. Want to know what something means in German? Well, that's on a separate page. Do you want to look something up while using your phone? Don't be stupid; use a desktop…

When you're dealing with unix-y Git repositories for example.

If you mean more from a user perspective, it really depends. For registry keys for example, since they're interacted with programmatically for the most part, I was expecting them to be case-sensitive. They're case-insensitive though, so that was a bit of a whiplash.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#279

Earlier quoted context omitted.

> I don't want to put leading zeroes before every all the single digit numbers in my file names. > ... it would be great if I could just trust that every device will understand numbers. Strings are not numbers, even if some part of their content "looks like a number." > I will add that I'm plenty "smart" enough to understand that "10" comes before "9" in a strictly alphabetical sense, and I still want my file manager…

> Display strings in a consistent, documented, manner. 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…

Do I understand that you want these to be sorted like this?

  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.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#280
post #107

Earlier quoted context omitted.

That's why we have all this LC_* stuff in Linux, which you can configure to your needs: export LC_MEASUREMENT="de_DE" export LC_MONETARY="de_DE" export LC_PAPER="de_DE" export LC_CTYPE=de_DE.UTF-8 export LC_MESSAGES="en_US.UTF-8" export LC_RESPONSE="en_US.UTF-8" export LC_TIME=en_US.UTF-8 Mix in your Swedish or Swaheli, maybe even the Vatican State: e.g. de_DE, sw_TZ, it_VA (not guaranteed ;-).

How does this work if you're a multi-lingual person and you have files with names in different languages?

The sorting order is only defined between strings of the same locale, not between strings of different locales.

You can specify the sorting order per command like

LC_COLLATE="tr_TR.utf8" ls

if it differs from your system or user locale.

An alternative is to first transliterate the strings to ASCII and then sort them (but this does not preserve the sorting order of non-latin scripts).

Post reply on HN