How to Shoot Yourself In the Foot Using Any Programming Language

The proliferation of modern programming languages (all of which seem to have stolen countless features from one another) sometimes makes it difficult to remember what language you’re currently using. This guide is offered as a public service to help programmers who find themselves in such dilemmas.

370 JCL

You send your foot down to MIS with a 4000-page document explaining how you want it to be shot. Three years later, your foot comes back deep-fried.

You shoot yourself in the head just thinking about it.

You find the first building you’re in in the phone book, then find your office number in the corporate phone book. Then you have to write this down and describe, in cubits, your exact location in relation to the door (the right side thereof). Then you need to write down the location of the gun (loading it is a proprietary utility), then you load it, and the COBOL program, and run them, and with luck, it may be run tonight.

Ada

If you are dumb enough to actually use this language, the United States Department of Defense will kidnap you, stand you up in front of a firing squad, and tell the soldiers, „Shoot at his feet.“

After correctly packaging your foot, you attempt to concurrently load the gun, pull the trigger, scream, and shoot yourself in the foot. When you try, however, you discover that your foot is of the wrong type.

You scour all 156e54 pages of the manuals, looking for references to foot, leg, or toe; then you get hopelessly confused and give up. You sneak in when the boss isn’t around and finally write the damn thing in C. You turn in 7,689 pages of source code to the review committee, knowing they’ll never look at it, and when the program needs maintenance, you quit.

Algol

You shoot yourself in the foot with a Civil War-era musket. The musket is aesthetically fascinating, and the wound baffles the adolescent medic in the emergency room.

Algol 60

You spend hours trying to figure out how to fire the gun because it has no provisions for input or output.

Algol 68

You mildly deprocedure the gun, the bullet gets firmly dereferenced, and your foot is strongly coerced to void.

APL

You shoot yourself in the foot, then spend all day figuring out how to do it in fewer characters.

You hear a gunshot and there’s a hole in your foot, but you don’t remember enough linear algebra to understand what happened.

@#&^$%&%^ foot

APT

You cut a perfect bullethole in your foot and shoot through it.

ASP

You try to shoot yourself in the foot, but the most advanced thing you can manage is to cut your wrist.

ASP.NET

Find a gun, it falls apart. Put it back together, it falls apart again. You try using the .GUN Framework, it falls apart. You stab yourself in the foot instead.

Assembly

You try to shoot yourself in the foot only to discover you must first reinvent the gun, the bullet, and your foot. After that’s done, you pull the trigger, the gun beeps several times, then crashes.

You try to shoot yourself in the foot only to discover that you must first invent the gun, the bullet, the trigger, and your foot.

You crash the OS and overwrite the root disk. The system administrator arrives and shoots you in the foot. After a moment of contemplation, the system administrator shoots himself in the foot and then hops around the room rapidly shooting at everyone in sight.

By the time you’ve written the gun, you are dead, and don’t have to worry about shooting your feet. Alternatively, you shoot and miss, but don’t notice.

Using only 7 bytes of code, you blow off your entire leg in only 2 CPU clock ticks.

BASIC

Shoot yourself in the foot with a water pistol. On big systems, continue until entire lower body is waterlogged.

C

You try to shoot yourself in the foot, but find out the the gun is actually a howitzer cannon.

You shoot yourself in the foot.

You shoot yourself in the foot and then nobody else can figure out what you did.

C++

You accidentally create a dozen clones of yourself and shoot them all in the foot. Emergency medical assistance is impossible since you can’t tell which are bitwise copies and which are just pointing at others and saying, „That’s me, over there.“

C#

You shoot yourself in the foot, but first have to switch to unsafe mode.

You forget precisely how to use the .NET interface and shoot yourself in the foot. You sue Microsoft for damages.

Clipper

You grab a bullet, get ready to insert it in the gun so that you can shoot yourself in the foot, and discover that the gun that the bullet fits has not yet been built, but should be arriving in the mail real soon now.

COBOL

Using a COLT 45 HANDGUN, AIM gun at LEG.FOOT, THEN place ARM.HAND.FINGER. on HANDGUN.TRIGGER and SQUEEZE. THEN return HANDGUN to HOLSTER. CHECK whether shoelace needs to be retied.

Allocate $500,000 for the project. Define foot, bullet, gun. Run press_trigger. Go for coffee break. Return in time to put foot under bullet.

You try to shoot yourself in the foot, but the gun won’t fire unless it’s aligned in column 8.

Concurrent Euclid

You shoot yourself in somebody else’s foot.

CSS

You shoot your right foot with one hand, then switch hands to shoot your left foot but you realize that the gun has turned into a banana.

Everyone can now shoot themselves in the foot, but all their feet come out looking identical and attached to their ears.

dBase

You buy a gun. Bullets are only available from another company and are promised to work so you buy them. Then you find out that the next version of the gun is the one that is scheduled to actually shoot bullets.

You squeeze the trigger, but someone corrupted the index and the bullet shoots you in the eye.

You squeeze the trigger, but the bullet moves so slowly that by the time your foot feels the pain you’ve forgotten why you shot yourself anyway.

Delphi

You try to shoot yourself in the foot but discover that the bullets you already had are not compatible with the new gun version, but Borland promises a fix real soon now.

DOS Batch

You aim the gun at your foot and pull the trigger, but only a weak gust of warm air hits your foot.

Eiffel

You create a GUN object, two FOOT objects, and a BULLET object. The GUN passes both the FOOT objects as a reference to the BULLET. The FOOT objects increment their hole counts and forget about the BULLET. A little demon then drives a garbage truck over your feet and grabs the bullet (both of it) on the way.

You take out a contract on your foot. The precondition is that there’s a bullet in the gun; the postcondition is that there’s a hole in your foot.

Forth

Foot in yourself shoot.

First you decide to leave the number of toes lost on the stack and then implement the word [email protected] takes three numbers from the stack: foot number, range, and projectile mass (in slugs) and changes the current vocabulary to blue. While testing this word you are arrested by the police for mooning (remember, this is a bottom-up language) who demonstrate the far better top-down approach to damaging yourself.

BULLET DUP3 * GUN LOAD FOOT AIM TRIGGER PULL BANG EMIT DEAD IF DROP ROT THEN. This takes about five bytes of memory, executes in two to ten clock cycles on any processor, and can be used to replace any existing function of the language as well as in any future words. Welcome to bottom-up programming, where you too can perform compiler pre-processing instead of actually writing code.

FORTRAN

You shoot yourself in each toe, iteratively, until you run out of toes, then you read in the next foot and repeat. If you run out of bullets, you continue anyway because you have no exception-handling ability.

Haskell

On a warm Saturday afternoon, sitting by the pool with a margarita, you casually sit up from your chaise lounge chair, reach over and pick up a gun, aim at your foot, and lazily pull the trigger.

You shoot yourself in the foot very elegantly, and wonder why the whole world isn’t shooting itself this way.

You spend several hours creating a new copy of the Universe which is identical to the existing one except your foot has a hole in it. You then hear that it can be done more elegantly with Dyadic Functile Hyper-Arrows, but the very act of reading some of the included sample code causes one of your metatarsals to explode.

HTML

You cut a bullethole in your foot with nothing more than a small penknife, but you realize that to make it look convincing, you need to be using Dreamweaver.

HyperTalk

Put the first bullet of the gun into foot left of leg of you. Answer the result.

You describe how to shoot yourself in the foot, which not only happens, but you also get cool visual effects.

As of HyperTalk 2.2, you cannot shoot yourself in the foot from within the stack; you must write this functionality into an XCMD or XFCN. However, we anticipate this functionality to be incorporated into the next major release.

IDL

You easily shoot yourself in the foot, complete with neat little graphs showing the trajectory of the bullet and the result of the impact. After twenty hours and ten thousand lines of code, your friend proudly announces that he has accomplished the same thing in an Excel spreadsheet.

Java

After importing java.awt.right.foot.* and java.awt.gun.right.hand.*, and writing the classes and methods of those classes needed, you’ve forgotten what the hell you’re doing.

You write a program to shoot yourself in the foot and put it on the Internet. People all over the world shoot themselves in the foot, and everyone leaves your website hobbling and cursing.

You amputate your foot at the ankle with a fourteen-pound hacksaw, but you can do it on any platform.

JavaScript

You’ve perfected a robust, rich user experience for shooting yourself in the foot. You then find that bullets are disabled on your gun.

You find that Microsoft and Sun have released incompatible class libraries both implementing Gun objects. You then find that although there are plenty of Foot objects implemented in the past in many other languages, you cannot get access to one. But, seeing as JavaScript is so cool, you don’t care and go around shooting anything else you can find.

LaTeX

compy$ more foot_shooting.tex
\documentclass[12pt]{article}
\usepackage{latexgun,latexshoot}
\begin{document}
See how easy it is to shoot yourself in the foot? \\
\gun[leftfoot]{shoot} \\
\pain
\end{document}
compy$ latex foot_shooting
…
line 6: undefined control sequence \pain

LISP

You shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which holds the gun with which you shoot…

You attempt to shoot yourself in the foot, but the gun jams on a stray parenthesis.

Logo

You can easily shoot the gun, but you have to work out the geometry to make sure the bullet goes into your foot.

Machine Language

Before you can shoot yourself in the foot you must disassemble the gun at the atomic level and then reassemble it. After you do this, you find that the bullets require a special operator so the gun doesn’t work.

Matlab

You shoot yourself in the foot five times from the command prompt before you can put your foot in an m file.

Once your foot is in an m file you shoot it fifty more ways effortlessly and then plot the results.

Eventually you can’t afford to continue shooting yourself in the foot this way, so you graduate to less elegant ways of shooting yourself in the foot with Excel.

Modula-2

After realizing that you can’t actually accomplish anything in this language, you shoot yourself in the head.

Motif

You spend days writing a UIL description of your foot, the trajectory, the bullet, and the intricate scrollwork on the ivory handles of the gun. When you finally get around to pulling the trigger, the gun jams.

MPW

Because you don’t actually have a gun, you write an imitation UNIX shell and shoot yourself in the foot using Pascal.

.NET

You can now shoot yourself in the foot with any of fourteen weapons, ranging from an antique medieval crossbow to a laser-guided Destructo-Beam. However, all these weapons must be manufactured by Microsoft and you must pay Microsoft royalties every time you shoot yourself in the foot.

Objective-C

You write a protocol for shooting yourself in the foot so that all people can get shot in their feet.

Occam

You shoot both your feet with several guns at once.

Oracle

You decide to shoot yourself in the foot, so you go out and buy a gun, but the gun won’t work without „deploying“ a shoulder holster solution, relational titanium-alloy bullets, body armor infrastructure, a laser sight assistant, a retractable arm stock application, and an enterprise team of ballistic experts and a chiropodist.

The menus for coding foot_shooting have not been implemented yet, and you can’t do foot_shooting in SQL.

Paradox

Not only can you shoot yourself in the foot, your users can too.

Pascal

The compiler won’t let you shoot yourself in the foot.

The gun is mounted such that it cannot point towards your feet, but you can swivel it round and shoot yourself in the head instead.

Perl

You shoot yourself in the foot, but nobody can understand how you did it. Six months later, neither can you.

You separate the bullet from the gun with a hyperoptimized regexp, and then you transport it to your foot using several typeglobs. However, the program fails to run and you can’t correct it since you don’t understand what the hell it is you’ve written.

You stab yourself in the foot repeatedly with an incredibly large and very heavy Swiss Army knife.

You shoot yourself in the foot and then decide it was so much fun that you invent another six completely different ways to do it.

There are so many ways to shoot yourself in the foot that you post a query to comp.lang.perl.misc to determine the optimal approach. After sifting through 500 replies (which you accomplish with a short Perl script), not to mention the cross-posts to the perl5-porters mailing list for which you upgraded your first sifter into a package, which of course you uploaded to CPAN for others who might have a similar problem (which, of course, is the problem of sorting out e-mail and news, not the problem of shooting yourself in the foot), you set to the task of simply and elegantly shooting yourself in the foot, until you discover that, while it works fine in most cases, NT, VMS, and various flavors of Linux, AIX, and Irix all let you shoot you in the foot sooner than your Perl script could.

PHP

You shoot yourself in the foot with a gun made with pieces from 300 other guns.

Three thousand people line up on your apartment’s welcome mat and demand to be shot in their feet. One by one, you oblige them, but halfway through, the http connection times out and the crowd lynches you.

PicoSpan

You can’t shoot yourself in the foot because you’re not a host.

Whenever you shoot yourself in the foot, someone opens a topic in policy about it.

PL/I

You discover 6,752 different guns for shooting yourself in the foot. Before you can decide which one to use, you starve to death.

After consuming all system resources including bullets, the data processing department doubles its size, acquires two new mainframes, and drops the original on your foot.

PostScript

foot bullets 6 locate loadgun aimgun shoot showpage

Prolog

You tell your program you want to be shot in the foot. The program figures out how to do it, but the syntax doesn’t allow it to explain.

Your program tries to shoot you in the foot, but you die of old age before the bullet leaves the gun.

Python

You try to shoot yourself in the foot but you just keep hitting the whitespace between your toes.

You shoot yourself in the foot and then brag for hours about how much more elegantly you did it than if you had been using C or (God forbid) Perl.

You create a gun module, a gun class, a foot module, and a foot class. After realizing you can’t point the gun at the foot, you pass a reference to the gun to a foot object. After the foot is blown up, the gun object remains alive for eternity, ready to shoot all future feet that may happen to appear.

Revelation

You’ll be able to shoot yourself in the foot just as soon as you figure out what all these bullets are for.

RPG

First you define your gun, bullet, and firing pin. Then, you define your foot, toes, and toenails. Then, you open chamber and load the gun. Then, you cock it. Now you’re finally ready to shoot yourself in the foot.

Ruby

Your foot is ready to be shot in roughly five minutes, but you just can’t find anywhere to shoot it.

You shoot yourself in the foot and then have to justify it to all your friends who are still naively using Perl.

SmallTalk

You spend so much time playing with the graphics and windowing system that your boss shoots you in the foot, takes away your workstation, and makes you develop in COBOL on a character terminal.

You shoot yourself in the foot and your foot sends doesNotUnderstand: Pain to your brain.

You daydream repeatedly about shooting yourself in the foot.

SNOBOL

If you succeed, shoot yourself in the left foot.
If you fail, shoot yourself in the right foot.

UNIX

Visual BASIC

You’ll shoot yourself in the foot, but you’ll have so much fun doing it that you won’t care.

You’ll only appear to have shot yourself in the foot, but you’ll have so much fun doing it you won’t care.

You do a Google search on how to shoot yourself in the foot using Visual Basic. You find seventeen completely different ways to do it, none of which are properly structured. You paste the first example into the IDE and compile. It brushes your teeth.

Visual BASIC.NET

You spend a fortune on a high-powered, self-cleaning, self-aiming, automatic handgun with unlimited ammo, only to realize it takes a year to pull the trigger.

Visual FoxPro

You mock other sharpshooters for not being able to shoot both feet at once, but when you try to do it yourself you realize that you can’t properly handle the Microsoft.gun ActiveX.