this post was submitted on 07 Jul 2023
410 points (98.8% liked)

Programmer Humor

19563 readers
1197 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 

you are viewing a single comment's thread
view the rest of the comments
[–] Freethewhat@lemmy.world 1 points 1 year ago (1 children)

Ugh, I just ran into this in Terraform. Why is this a thing?

[–] Swiggles@lemmy.blahaj.zone 7 points 1 year ago (1 children)

It's just sorted alphabetically (technically it is the UTF16 code order). To be fair it's a sane default for most use cases. In JS case you can define a very simple callback to change the behavior to numeric sorting (a,b => a<b). Many other sorters provide a flag instead, but numeric sorting is seldom the default as it is not as useful most of the time in weakly typed languages.

[–] excel@lemmy.megumin.org 2 points 1 year ago

weakly typed languages

Well, looks like we found the problem right there