In the context of functional programming, a typical example of a side effect is "launch the mis开发者_如何学编程siles". Where does that expression come from historically?
Where does "launch the missiles" come from historically?
Good luck with that—it's more of a research question than a programming one.
Here are two data points:
I have heard Simon Peyton Jones use the exact phrase as an example in talks at least ten years ago.
In the early 1990s, maybe even in 1990, Computer Professionals for Social Responsibility had T-shirts made showing a picture of an atomic blast and the written legend
The ultimate error message
I'll wager the phrase goes back at least that far.
To get a real answer, you need a lexicographer, not a programmer.
I have no proof of this but I always assumed it comes from a similar piece of buggy C code:
if (hasSecurityClearance = true)
{
launchMissiles();
}
"Launch the Missiles," in transactional memory, is used to emphasize that I/O is irrevocable. Once the missiles are launched (i.e. the network packet is sent), it's on its way and can't be called back. For a transaction, that means that you can't abort anymore. Instead, since you've already published your results (BOOM), you must find a way to finish.
Transactional memory was first proposed in 1993, well after Wargames was released and stopped being cool. This 2006 TM paper from Simon Peyton-Jones (page 2) is the first place where I've found the "launch the missiles" analogy. Could this be the origin?
There are software apps out there which do indeed manage the launching of ICBMs, so there must be projects whose Risk Assessment must cover the accidental triggering of nuclear annihilation. However, it doesn't seem as though the phrase refers to a real incident. Of course, if such a thing did ever happen, you can bet the Black Helicopters were out smartish to suppress all traces of it.
Anyway, I think it's just a hyperbolic answer to the question "What's the worst that could happen?" The origins probably come from something like the film 'Wargames', where an AI almost starts a nuclear war because it thinks it is playing a game.
I suppose the other thing is, it isn't really a side-effect. Missile launch control programs are supposed to launch the missiles; it's just, they should only launch 'em after all the necessary checks have been made. So it's about ensuring that we don't get to step 10: Launch the missiles until after we've been through Step 1: Wake the president, Step 2: Check the target coordinates, etc
I've heard it in the context of rollbacking database transactions, as an example of an action that can't be undone: "it's hard to un-launch a missile."
精彩评论