this post was submitted on 07 Jul 2023
74 points (100.0% liked)

Programmer Humor

19176 readers
1010 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
[–] [email protected] 0 points 1 year ago (1 children)

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

[–] [email protected] 2 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.

[–] [email protected] 2 points 1 year ago

weakly typed languages

Well, looks like we found the problem right there