this post was submitted on 25 Jul 2024
195 points (95.8% liked)

Programmer Humor

24932 readers
2362 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 2 years ago
MODERATORS
 
top 5 comments
sorted by: hot top controversial new old
[–] CodexArcanum@lemmy.world 25 points 11 months ago (1 children)

Javascript devs be like...

[–] palordrolap@kbin.run 6 points 11 months ago (1 children)

It isn't just JavaScript (or Java which uses the "Hashmap" name).

There are, of course, languages that don't have an equivalent structure, but for those that are sufficiently popular, it's almost certain that someone has written a library that emulates associative arrays and then fairly certain that that library, in turn, has been used in production somewhere.

File this under "If it's stupid but it works..."

[–] CodexArcanum@lemmy.world 19 points 11 months ago

I'm just poking fun that the fundamental type in JS (Object) is an associative-array/hashmap. Technically it has some fancy under-the-hood handling for pure arrays and primitive types. This is also exactly true of Lua, and a little true of Ruby and Python.

Really, most programmers would do great to start with a hash map or array list and only specialize out further when the problem calls for it.

[–] DScratch@sh.itjust.works 10 points 11 months ago

Hashmaps are just arrays with notions. Sets are just hashmaps with doormen.

[–] joyjoy@lemm.ee 7 points 11 months ago

Lua tables are secretly hashmaps