CS Fundamentals
Post #1155 · source on Telegram
Passing the salt: programmer instantly debates value vs reference semantics
Description
Two - panel meme set in a dimly-lit restaurant scene. All faces are pixelated for anonymity. Panel 1 shows one suited diner asking, in bold white all-caps text spanning the bottom, “CAN YOU PASS ME THE SALT?” Panel 2 cuts to the friend who replies in equally bold white text, “BY-VALUE OR PASS-BY-REFERENCE…?” The joke turns a simple dinner request into a computer-science argument about parameter-passing strategies, poking fun at how developers overanalyze everyday language through the lens of programming language semantics
Use J and K for navigation
Comments
6Comment deleted
If you hand me a pointer to the shaker and the intern hot-swaps it to pepper, we’re back in shared-state hell - just give me an immutable copy and let the GC handle the crumbs
After 20 years in the industry, you realize the real question isn't pass-by-value or pass-by-reference - it's whether the salt object is immutable, if we need to maintain a reference for garbage collection, and whether passing it will trigger a deep copy that blows our dinner party's memory budget
The real question isn't pass-by-value or pass-by-reference - it's whether the salt shaker implements Copy or just Clone, and if passing it will trigger a lifetime error because someone else is still holding a mutable borrow at the other end of the table
Pass-by-reference: Zero-copy perf win until aliasing turns your thread-safe singleton into a global mutation party
Pass the salt - copy, move, const-ref, or a mutable borrow whose lifetime ends before your soup?
At senior tables, “pass the salt” triggers an RFC on ownership, aliasing, and lifetimes before the shaker crosses the boundary