Live data from Hacker News

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

sebastiano.tronto.net

361–370 of 385 posts

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

#361
post #343

Earlier quoted context omitted.

>Depending on the decision, either lists of decimal numbers or lists of version numbers will be sorted wrong. Yes. I don’t see why this is a big deal. I didn’t suggest adjusting the logic based on the number of decimal points.

Ah ok. I understand that you found your perfect trade-off for sorting based on longer considerations. But it will be difficult to communicate such a concept to a user. Applying partial rules to improve sorting in one direction is not a lossless activity, it makes the UX actually worse in other scenarios as the user is first guided to assume a certain behavior, but then learns that his expectation is broken in adjacen…

> But it will be difficult to communicate such a concept to a user.

This isn't a prerequisite, since the existing naive character sort approach is not communicated either. In fact, it's almost universally unexpected by any user who hasn't written a naive string sort. Apple doesn't do this, and I very much did not need it communicated to me why 10 was coming after 2, because that's what everyone, who's not a programmer, expects.

As a litmus test, go ask some people, who are not programmers, without loading the question beyond "here are some files, how would you expect for them to be displayed in a list?". Show the lists side by side. It should not surprise you.

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

#362
post #233

Earlier quoted context omitted.

Unicode has many different representations of digits, and I would dispute using the term “alphabetical” to refer to digit ordering in any case.

You are starting to sound like a troll. Yes, unicode has many representations of digits. That has nothing to do with the question of whether 2.jpg should come before or after 10.jpg.

You think user deserve to have control, but you think that control only needs to extend to the treatment of those ten characters, nothing else?

I guess your position is coherent, but it’s very silly.

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

#363
post #359

Earlier quoted context omitted.

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

> Does it matter? Yes. An algorithm must be unambiguosly specified for all possible inputs.

> An algorithm must be unambiguosly specified for all possible inputs.

And it is. It's just that some outputs may not match what the user expects. TFA's preferred algorithm (simple lexicographic sorting) matches user expectations 90% of the time. The algorithm actually in use on most OSs (simple lexicographic sorting + treat consecutive digits as combined numbers) matches expectations 99% of the time. An algorithm that matches expectations 100% of the time doesn't exist. Shouldn't we pick the 99% algorithm?

(I am admittedly making up the actual percentages, but you get the point.)

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

#364

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…

Your concept appears to have coherence until you consider that numbers are not necessarily expressed in decimal notation. What about hexadecimal numbers in filenames? Should they be sorted your way?

And what about very long strings of digits in the filenames - so long that they are too long for even the longest available numerical representation? In some apps, they are converted to floating point...

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

#365
post #233

Earlier quoted context omitted.

You are starting to sound like a troll. Yes, unicode has many representations of digits. That has nothing to do with the question of whether 2.jpg should come before or after 10.jpg.

You think user deserve to have control, but you think that control only needs to extend to the treatment of those ten characters, nothing else? I guess your position is coherent, but it’s very silly.

Those ten characters are of disproportionately high importance (to put it mildly).

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

#366
post #313

Earlier quoted context omitted.

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?

That is just silly notation used by a minority in this world ;-)

Perhaps, but if you set your browser language to US English you have dates displayed as MM.DD.YYYY and there's no way to change it neither to European nor ISO (YYYY-MM-DD) format.

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

#367

Earlier quoted context omitted.

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…

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

> Strings are not numbers, even if some part of their content "looks like a number."

Irrelevant and intentionally obtuse. Filenames can't be anything but strings - there's literally no way to mark part of a filename as "this is an integer", so the idea that "strings are not numbers" is ridiculous because the only way to encode numbers (which people constantly want to encode) is as part of a string - which means that parts of filenames are numbers, because that's exactly how people use them.

> Problem is, this is your preference for a specific situation. Which may not be another person's preference in the same situation nor yours in a different situation.

> So what are programs to do?

> Display strings in a consistent, documented, manner. Which is lexicographical ordering in all cases lacking meta-data to indicate otherwise.

These do not follow from each other.

First, the assertion that "peoples' preferences are different, so we shouldn't pick an overwhelmingly common preference" is laughably false. The vast majority of computer users (which happen to not be people on HN) prefer "sort numbers by number rather than by UTF-8 value", so that's simply the correct way to sort.

Second, even regardless of the above, there's nothing preventing a "by name" sorting from being consistent and documented.

Either way, this line of reasoning is just wrong.

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

#368

Earlier quoted context omitted.

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

I hope you don't ever copy files.

I copy files all the time? I have files in my documents folder with creation dates in the 90's that have been copied forward between many computers.

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

#370
post #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 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.

> With ASCII lexicographic ordering, photo01 would come before photo1.

Good catch. I did not closely inspect the ordering initially presented, which was:

  photo1 photo01 photo001 photo0001 photo2
This does not represent a valid sort order based solely on file names produced by `ls`, which would be:

  photo0001 photo001 photo01 photo1 photo2
Post reply on HN