Lurker News
Back to discussion

Comment by _kst_

_kst_2 replies#
Because passing the city by copy is way too expensive and won't destroy the original city anyway.
ehnto2 replies#
Depending on the language the ampersand could mean by copy or by reference. I suspect the commentor wants by reference, since they want to examine it later.
SV_BubbleTime#
Your right; I meant by reference. I also said MISRA, which implies destruction by means of Sea monster.
KMag1 reply#
> Depending on the language the ampersand could mean by copy or by reference

Yikes. Which languages use ampersand to signal passing by value? That's a massive footgun if I'm ever cargo-culting my way through writing some code in one of those languages for the first time.

FroshKiller1 reply#
Isn't the real footgun trying to do work you don't adequately understand?

Continue this thread — 1 reply

simonh#
Ok, here's a variation.

A programmer is drafted by the military and ordered to write the software for a city destroying weapon. Given the freedom to choose the implementation language, he chooses Javascript. The user enters the city to be destroyed, which is passed to the Function destroyCity().
The General returns from the weapon's fist use in battle furious. "We fired your damn weapon at Bahgdad, and the city's still there! What's going on?"
"I think I know" says the programmer. Javascript passes it's parameters by value, not by reference."