Home » Uncategorized

Shooting yourself in the foot in various programming languages

This article comes from Toodarkpark. Below is an extract, covering a few of the programming languages listed in the original article.

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

2808319787In this article, programming languages are listed in alphabetical order: 

C++

  • You accidentally create a dozen instances of yourself and shoot them all in the foot. Providing 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.”

COBOL

  • USEing 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.

Java

  • 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.

Perl

  • 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.

Python

  • 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.

SAS

  • You spend three hours trying to cut your way through your foot with a rock flake, only to realize that the language was invented before guns allowed you to shoot yourself in the foot interactively in one easy step with no programming.
  • You have no idea that the gun, the bullet, or your foot exists. The gun is locked in a safe in a bank vault on the other side of the galaxy, the bullet is locked in a safe in a bank vault in another galaxy, and the people who know the combinations for the safes and bank vaults died ten million years ago. Still, the gun goes off and fires the bullet through your foot.

Related article: Which Programming Language to Choose?. If you want to check out many more languages, click here

DSC Resources