7 ms·
How to shoot yourself in the foot in any programming language
- gpjt 13y agoSome classics there (there have been versions of this knocking around since at least the mid-90s and probably much earlier) but it's great to see some new ones.
- AndrewDucker 13y agoI first encountered it in 1991, I think. Probably on the Monochrome BBS.
- meapix 13y agomy favorite is unix way of shooting in the foot.
- rkv 13y agoThat and Perl.
- twic 13y agoMine is the 370 JCL, because of the surreal but instantly familiar "three years later, your foot comes back deep-fried". The only problem is that neither i nor anybody else alive today has any idea what 370 JCL is. Can someone repurpose this to be about the Cloud?
- AndrewDucker 13y agoThankfully, I don't have to deal with it any more, but Z/OS JCL is dealt with on a daily basis by people sitting within five feet of me.
- twic 13y agoThey have five feet? Sounds like someone ran the batch too many times.
- cafard 13y agoThe last version I saw, probably 20 years ago, had the APL version something like "Somewhere a gun goes off and hole appears in your foot, but you don't remember enough linear algebra to figure out how this happened."
- milesokeefe 13y ago>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. Anyone have a modern version for this?
- samatman 13y agoWell, first you have to pick a gun framework, then figure out how to $elect your gun in it. Then you update the Gun model and set a callback onFire, and wonder what the hell happened. Later, the callback shoots you in the back of the head.
- pkorzeniewski 13y agoMy take: > Javascript > There're so many guns to choose from that when you finally choose one, it's suddenly no longer cool to shoot yourself with it so you look for another one. ps. I love Javascript :)
- talmand 13y agoMy version of this: "You have the gun, but you never fire it because you can't decide on accessories."
- RyanMcGreal 13y agoself.shoot(function() { holster.unclip(function() { gun.remove(function() { safety.disable(function() { trigger.pull(function() { // help I'm trapped in a callback factory }); }); }); }); });
- talmand 13y agoI was thinking along the lines of, "After building a suitable gun, you find it doesn't fire because the bullets are of the wrong type."
- mcdougle 13y ago
- DanWaterworth 13y agoHaskell - You try to shoot yourself in the foot, but instead, a new foot appears in front of you that is identical to your own except that it has a bullet in it. Oh, and it's wrapped inside a burrito for some reason...
- joejohnson 13y agogun `shoot` foot But there’s a side effect, so it doesn’t work. Try to use the state monad… get confused, so you write your own shooting monad, and then come up with this code: gun >= id foot but this puts your gun in your foot. Then you write your data types data Space = Empty | Gun| Foot deriving (Show, Eq, Ord) –if you’re right-handed, this code should work shootFoot = foldr (shoot bullet) Empty $ enumFromTo Gun Foot –For southpaws foldl’ (shoot bullet) Empty $ enumFromTo gun foot
- jerf 13y agoExcellent. I also would have accepted Violence.hs:5:35: No instance for (Shootable BodyPart) arising from a use of 'shoot' Possible fix: add an instance declaration for (Shootable BodyPart) In the expression: shoot $ user ^. foot In an equation for 'violence': violence user = shoot $ user ^. foot
- DanWaterworth 13y agoYou should abstract this; you realize bullets are group actions on the set of feet, right? Edit: Sorry, not group actions, monoid actions. Group actions would mean there was some kind of inverse bullet. Also note that bullets aren't commutative.
- rev_null 13y agoThe new foot only appears if you try to do something with it.
- mercurial 13y agoYou try to shoot yourself in the foot, but you realize the bullets are of the wrong type. After sawing the bullets to the right size, you attempt to lift your gun, but it takes too much space and blows up.
- peterkelly 13y agoObjective C/Cocoa: Simply use the built-in API: [[[FSGun alloc] initWithGunType: FSGunTypeShotgun] shootBodyPart: FSBodyPartFoot side: FSBodyPartFootSideLeft onPerson: self]
- talmand 13y agoI don't like the CSS one. Here are a few ideas: You take the gun to a smaller room and it disappears. You're left-handed but the gun doesn't support left-hand prefixed properties. The gun is too big in your right hand but too small in your left hand. You take the gun to a different range and your beautiful, well designed gun is suddenly too ugly to behold. You miss your foot because you're standing in line next to a guy that's floating.
- tekacs 13y agoYou try to center your gun over your foot but can only center bullets.
- deleted 13y ago[deleted]
- dave1010uk 13y agoAlong the same lines: "If programming languages were cars" http://users.cms.caltech.edu/~mvanier/hacking/rants/cars.html http://users.cms.caltech.edu/~mvanier/hacking/rants/cars.htm...
- hawkw 13y agoOkay, I'll admit that the whitespace crack at the end was pretty funny.
- SeanDav 13y agoThey are all pretty funny, at least when I can actually understand the inside joke...
- GrinningFool 13y agoErlang: * You send a message to your hand process to shoot yourself in the foot. * Hand process sends a message to the gun process. * Gun process sends a message to the primer process. * Primer process sends a message to the foot process, using the bullet to contain state. * Bullet state is passed to the foot process, * Foot process creates a copy of your foot that contains a hole, and sends a message to the leg process indicating that it should accept the replacement foot...
- Toenex 13y agoBefunge [http://en.wikipedia.org/wiki/Befunge http://en.wikipedia.org/wiki/Befunge] _ _ _ .'`; _(_)(_)(_)| | (_) `--' .-'``````---. ,-.______________,=========, | ; [| )_____________)#######((_ `'-......---'' /===============.-.___,--" _\ .-'``'. "-._,__,__[JW]____\########/ | ( \ ( )) )####O##( | \ \ \___/,.#######\ : \ `====" \#######\ : `. \#######\ : \ )##O####| | | )####__," \ / `--"" `'-...-'`
- fein 13y agoI usually liken PHP to an AK-47. Its rickety, it bends and moves when you use it, but no matter what it just keeps working. Although there have been new platforms to come out with superior technology, none can match its simplicity and ease of use, and because of this it has been used in more instances than any other. Hell, even a kid can operate it.
- dethtron5000 13y agoGo: "Don't share a bullet by shooting, shoot yourself by sharing a bullet."