Live data from Hacker News

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

sebastiano.tronto.net

261–270 of 385 posts

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

#261
Numbers aren't part of "the alphabet", so sorting digits within a string by the numeric value makes just as much sense (and is what most users want most of the time) as treating digits as isolated characters (what OP wants).

As an aside, this is also the reason why ISO 8601 is the best date format – it sorts the same way whether you do it alphabetically or lexicographically.

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

#262
post #50
post #35

> Well, apparently all these operating systems have decided that no, users are too dumb and they cannot possibly understand what alphabetical order means. So when you ask them to sort your files alphabetically, they don’t. Instead, they decide that if some piece of the file name is a number, the real numerical value must be used. Well, no. You don't actually ask them to sort in alphabetical order. You ask them to sor…

> And they choose the interpretation that (per their reasoning, and possibly some actual data) seems most likely to correspond to what the user wants. Yes, that make sense, but the problem is that this interpretation changed in the last 10 (15? 20?) years. It used to be that "by name" meant "by name, il alphabetical / lexicographical order" in pretty much every file manager.

It never was "alphabetical" but rather an order determined by the numeric index into the used encoding table.

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

#263

Earlier quoted context omitted.

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

You prefer looking at photos in that weirdly particular shuffled order that isn't the order they were taken in?

If I want to sort by date, I sort by the "Date" column, not the file name

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

#264
I have the same issue with "15 minutes before" instead of "2025-09-29 01:13:30".

(Which is wrong once the site doesn't update)

Needless to say, those are all "features" dumbing us down in the long run.

A philosophical side question: I want to opt out of this but I can't. So is this is case where my peers are limiting my intellectual development? I.e. preventing me from a) doing the time calculations in my head, b) writing my software such that is uses leading zeros?

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

#265
post #132

Earlier quoted context omitted.

> 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

I just tried it on Mac, its sorted in the order you listed. Extending it a bit, the order is: photo1 photo01 photo001 photo0001 photo2 So the shorter representation of the same number comes first. It does make intuitive sense to me.

> I just tried it on Mac, its sorted in the order you listed. Extending it a bit, the order is:

> photo1 photo01 photo001 photo0001 photo2

What you enumerated is known as "ascending lexicographical ordering" and has nothing to do with "the shorter representation of the same number", but instead the ASCII[0] character values in each file name.

0 - https://man.freebsd.org/cgi/man.cgi?query=ascii&apropos=0&se...

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

#266

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…

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

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

#267

Earlier quoted context omitted.

I just tried it on Mac, its sorted in the order you listed. Extending it a bit, the order is: photo1 photo01 photo001 photo0001 photo2 So the shorter representation of the same number comes first. It does make intuitive sense to me.

> I just tried it on Mac, its sorted in the order you listed. Extending it a bit, the order is: > photo1 photo01 photo001 photo0001 photo2 What you enumerated is known as "ascending lexicographical ordering" and has nothing to do with "the shorter representation of the same number", but instead the ASCII[0] character values in each file name. 0 - https://man.freebsd.org/cgi/man.cgi?query=ascii&apropos=0&se...

With ASCII lexicographic ordering, photo01 would come before photo1.

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

#268

Earlier quoted context omitted.

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

The ancient Romans claimed to have had a 10-month calendar [1], which is what I assume the reference is. Either that, or when month 6 got renamed August in honor of Emperor Augustus [1] https://en.wikipedia.org/wiki/Roman_calendar#Legendary_10-mo...

> The ancient Romans claimed to have had a 10-month calendar [1], which is what I assume the reference is.

Well, in the first place (as you note), there is no reason to believe that claim - the ancient Romans never made such a claim, but the classical Romans made that claim about the ancient Romans - but more importantly even if it were true the months would have been added many centuries prior to "about two thousand years" ago. Nothing related to additional months happened two thousand years ago.

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

#269
Unfortunately, it's not so simple, especially once you go beyond the ASCII. Dylan Beattie has this brilliant talk [1] where he points out how even the "systems" in human language involve a pile of quirks rather than any simple clean rules, and many of those rules are conflicting and the appropriate order of precedence depends on the context. Eg: the correct sorting order for the same sets of strings might even depend on the geography in which the question is asked!

If you haven't had to deal with it previously, you'd be flabbergasted at how many foot-guns there are in such a simple question as alphabetical sorting, even without involving numeric components in strings.

[1] There's no such thing as plain text https://www.youtube.com/watch?v=ajfb5LSbQVM

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

#270

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 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 managers to sort "9" before "10". I don't want to put leading zeroes before every all the single digit numbers in my file names. (And then potentially go come back later and add even more leading zeroes once the maximum number reaches three digits.) --- I split all of my audiob…

And maybe someone else uses “American” style dates in their file names mm-dd-YYYY, can those also be put in correct order for those users?
Post reply on HN