Live data from Hacker News

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

sebastiano.tronto.net

221–230 of 385 posts

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

#221
post #193
post #192

Earlier quoted context omitted.

"The author's situation is extremely rare" People sorting their files for alphabetical order is extremely rare? And right now I fail to see even one 'case where someone wants "10" to be before "9"'

People sorting their files in alphabetical order but who want numerical values in their files to be sorted digit by digit instead of as numbers is the rare case. I might go further in my ideal sorting algo which would be normalize capitalization and ignore all non-alphanumeric characters and treat them all as separators.

> ignore all alphanumeric characters

There's not much left to sort by then, is there?

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

#222
post #119

Maybe it's just me but I don't miss this at all: Image-1.jpg Image-11.jpg Image-2.jpg The only time natural sort bit me was with nonsensical names like .jpg

I think it depends on the person. That order is exactly what I expect and want.

Same here. I was surprised at everyone here who prefers the more-complicated-but-arguably-more-intuitive lexical sort. Naive alphabetical sorts break some expectations, but don't produce any weird edge cases.

I wonder if there's an age divide at play here, where those of us who grew up with the naive alphabetical sort prefer it.

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

#223
In case anyone else strongly disagrees with the author and wants to implement the Microsoft/Google/KDE/etc behavior, Google conveniently has this open sourced: https://github.com/google/closure-library/blob/b312823ec5f84...

How did I find it? Well I wanted to implement it a while ago and I found it in Closure a library I was already using.

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

#224
post #221
post #193

Earlier quoted context omitted.

People sorting their files in alphabetical order but who want numerical values in their files to be sorted digit by digit instead of as numbers is the rare case. I might go further in my ideal sorting algo which would be normalize capitalization and ignore all non-alphanumeric characters and treat them all as separators.

> ignore all alphanumeric characters There's not much left to sort by then, is there?

Good catch! Fixed.

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

#225
If they truly want alphabetical order wouldn't it be that the 9 is "nine" and 1 is "one" and therefore nine would be before one?

Otherwise they mean lexicographical where they only look at the left most value and sort that.

You can't ask for something to be alphabetical and expect it to sort numerically.

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

#226
it's weird to me that all the people declaring that they know what the average user wants to see, don't also suggest that the computer should rename files it encounters as necessary to give the user what the user wants.

if we don't have to collate as dictated by ascii, why should we expect users to live within the bounds of file names with dotted extensions? you think users care whether something is a jpg or a png? do users want to see .MOV and .mov next to each other (not because sort, because one camera programmer did it that way for an ancient DOS filesystem, and another didn't.) (unix, btw, never required that users live with dotted extensions, that was a digital knockoff/cpm/microsoft thing that you didn't understand so all your new tools enforce it even though you never had to put your code in a .c file, that was just for your convenience as the user whose needs must be respected)

so, we have to have "computery filenames" but we should violate "computery sorting"? how incredibly close-minded of you, you have no idea or basis to know what users want to see. oh, and the solemnity with which you make these proclamations, ok, don't get me started on that.

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

#227
post #156

Earlier quoted context omitted.

Obviously. All I'm saying is that this particular decision ought not to have been taken from the user. Real alphabetical order is not an unreasonable thing to want.

“Real alphabetical ordering” is incredibly nonspecific. It’s underspecified even for ASCII-US, but essentially meaningless for those of us in 2025 who need to handle Unicode. How do capital letters sort relative to lowercase letters? How do letters sort relative to digits? How do you consider code points that can correspond to different letters in different lettering systems with different ordering? How do you handle…

You're focusing on the wrong part of the problem when you say "essentially meaningless". Yes, choices must be made about how you order your "alphabet". But the meat of the request is that sorting goes character by character. That's a clear criteria, even with Unicode involved.

And I would say the reasonable way to define character is grapheme cluster and yes you want it stable to normalization and encoding.

How capital letters/diacritics/different representations affect the order of your alphabet, and which ones are considered equivalent, is something without a clear answer. Same for whether letters or numbers come first, and where punctuation goes. But you don't need consensus on that to fix the problem in the post.

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

#230

Isnt the author confusing "alphabetical sorting" with "ASCII sorting"? Afaik there is no universal way to handle numbers in alphabetical lists. Sometimes numbers some before letters, sometimes after, etc. A digit is not a part of the alphabet, right?

> Isnt the author confusing "alphabetical sorting" with "ASCII sorting"?

But it's actually not ASCII sorting either! ASCII sorting would mean 'Z' comes before 'a' and I assume even the author doesn't want that!

No matter what, there are going to be hidden tricks!

Post reply on HN