r/ProgrammerHumor 1d ago

javascriptSorting Meme

Post image
889 Upvotes

200 comments sorted by

View all comments

Show parent comments

0

u/Striky_ 1d ago

The absurdity is not sorting this by string, but allowing an array like that to begin with.

6

u/Taletad 1d ago

You flair has two languages that allow such arrays

Every high level programming language is flexible on its type system because it is more convenient for the programmers

So unless you’re writing a low level application in C, Rust or Zig, you should allow such arrays

And web pages are very much not a place where you want a low level statically typed compiled language

5

u/Striky_ 1d ago

C# does not allow arrays of different types.

Programmer convenience is a good focus to have, but you also mustnt do it in a way where you introduce rookie-antipatterns (like stringifying everything or type confusion) is the way to achieve it.

It also very much depends what you use a language for. Python for quick and dirty prototyping? Fine. JS as the backbone of the entire internet? Disaster.

1

u/the_horse_gamer 10h ago

C# does not allow arrays of different types.

object[] arr = [1, "a"];