digitalmars.D - Fun: Shooting yourself in the foot in D
- =?UTF-8?Q?Ali_=c3=87ehreli?= (17/17) Oct 27 2016 http://www.toodarkpark.org/computers/humor/shoot-self-in-foot.html
- Steven Schveighoffer (4/20) Oct 27 2016 You create a large meta-template library called footMassage, which then
- =?UTF-8?Q?Ali_=c3=87ehreli?= (4/6) Oct 27 2016 The first thing that came to my mind was a template-generated gun as
- cym13 (3/9) Oct 27 2016 Then the GC kicks in and triggers it.
- Guillaume Boucher (6/9) Oct 27 2016 Accidentally compiling a massage into a gun is not a high
- Stefan Koch (4/38) Oct 27 2016 You would never shoot youtself in the foot. after 5 minutes the
- A D dev (9/28) Oct 27 2016 1) You pre-shoot the bullet while the gun is being made - for
- Idan Arye (3/22) Oct 27 2016 You conceive a baby which is born with a bullet genetically shot
- =?UTF-8?Q?Ali_=c3=87ehreli?= (4/9) Oct 27 2016 Like others, this one is very nice! Especially interesting to note that
- Temtaime (3/22) Oct 27 2016 You create some complicated template function and then compiler
- Kirill Kryukov (2/6) Oct 27 2016 You shoot yourself in a tuple containing your foot, boot and sock.
- Chris (3/5) Oct 28 2016 Cannot implicitly convert expression (map(shoot(foot))) of type
- Patric Dexheimer (2/9) Oct 28 2016 You create the bullet in your foot for efficiency (CTFE).
- Chris (4/15) Oct 28 2016 You shoot yourself in the foot, but it doesn't matter, it was
- Guillaume Piolat (3/22) Oct 28 2016 When you try shooting at your foot with your AK-47, you realize
- =?UTF-8?Q?Ali_=c3=87ehreli?= (4/6) Oct 28 2016 Or... the bullet stops midair, waiting for the GC to finish a collection...
- John Colvin (4/23) Oct 28 2016 You unregister your feet from the runtime in order to move
- Dominikus Dittes Scherkl (3/6) Oct 28 2016 This is the best one so far! This is typical D: circumvent safety
- =?UTF-8?Q?Ali_=c3=87ehreli?= (3/4) Oct 28 2016 Wow. I've just said almost the same thing before reading this one. :)
- captaindet (27/27) Oct 30 2016 as i just happened to have me mutilated, i couldn't resist (even though
- =?UTF-8?Q?Ali_=c3=87ehreli?= (4/8) Oct 30 2016 Those toes are toolong and one is already missing. Make sure that the
http://www.toodarkpark.org/computers/humor/shoot-self-in-foot.html Some entries for reference: C - 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 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." 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. What would the entry for D be? :) Ali
Oct 27 2016
On 10/27/16 3:49 PM, Ali Çehreli wrote:http://www.toodarkpark.org/computers/humor/shoot-self-in-foot.html Some entries for reference: C - 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 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." 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. What would the entry for D be? :)You create a large meta-template library called footMassage, which then ends up via compiler inference compiling into a gun instead. -Steve
Oct 27 2016
On 10/27/2016 12:59 PM, Steven Schveighoffer wrote:You create a large meta-template library called footMassage, which then ends up via compiler inference compiling into a gun instead.The first thing that came to my mind was a template-generated gun as well. :) Ali
Oct 27 2016
On Thursday, 27 October 2016 at 19:59:09 UTC, Steven Schveighoffer wrote:On 10/27/16 3:49 PM, Ali Çehreli wrote:Then the GC kicks in and triggers it.[...]You create a large meta-template library called footMassage, which then ends up via compiler inference compiling into a gun instead. -Steve
Oct 27 2016
On Thursday, 27 October 2016 at 19:59:09 UTC, Steven Schveighoffer wrote:You create a large meta-template library called footMassage, which then ends up via compiler inference compiling into a gun instead.Accidentally compiling a massage into a gun is not a high priority bug. In order to become the safest language available, we should concentrate our effort implementing a nitrogen oxide detector (which handles all non-pathological examples of smoke).
Oct 27 2016
On Thursday, 27 October 2016 at 19:59:09 UTC, Steven Schveighoffer wrote:On 10/27/16 3:49 PM, Ali Çehreli wrote:You would never shoot youtself in the foot. after 5 minutes the compiler dies with an OOM.http://www.toodarkpark.org/computers/humor/shoot-self-in-foot.html Some entries for reference: C - 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 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." 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. What would the entry for D be? :)You create a large meta-template library called footMassage, which then ends up via compiler inference compiling into a gun instead. -Steve
Oct 27 2016
On Thursday, 27 October 2016 at 19:49:16 UTC, Ali Çehreli wrote:http://www.toodarkpark.org/computers/humor/shoot-self-in-foot.html Some entries for reference: C - 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 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." 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. What would the entry for D be? :) Ali1) You pre-shoot the bullet while the gun is being made - for efficiency (CTFE). As a result, it misses the foot, which has not grown yet. 2) From that link: http://www.toodarkpark.org/computers/humor/shoot-self-in-foot.html this one is good: Concurrent Euclid: You shoot yourself in somebody else's foot.
Oct 27 2016
On Thursday, 27 October 2016 at 19:49:16 UTC, Ali Çehreli wrote:http://www.toodarkpark.org/computers/humor/shoot-self-in-foot.html Some entries for reference: C - 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 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." 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. What would the entry for D be? :) AliYou conceive a baby which is born with a bullet genetically shot in the foot
Oct 27 2016
On 10/27/2016 03:07 PM, Idan Arye wrote:On Thursday, 27 October 2016 at 19:49:16 UTC, Ali Çehreli wrote:http://www.toodarkpark.org/computers/humor/shoot-self-in-foot.htmlYou conceive a baby which is born with a bullet genetically shot in the footLike others, this one is very nice! Especially interesting to note that genetic and generative have the same root. :) Ali
Oct 27 2016
On Thursday, 27 October 2016 at 19:49:16 UTC, Ali Çehreli wrote:http://www.toodarkpark.org/computers/humor/shoot-self-in-foot.html Some entries for reference: C - 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 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." 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. What would the entry for D be? :) AliYou create some complicated template function and then compiler show you an ICE.
Oct 27 2016
On Thursday, 27 October 2016 at 22:24:57 UTC, Temtaime wrote:On Thursday, 27 October 2016 at 19:49:16 UTC, Ali Çehreli wrote:You shoot yourself in a tuple containing your foot, boot and sock.[...]You create some complicated template function and then compiler show you an ICE.
Oct 27 2016
On Friday, 28 October 2016 at 01:25:55 UTC, Kirill Kryukov wrote:You shoot yourself in a tuple containing your foot, boot and sock.Cannot implicitly convert expression (map(shoot(foot))) of type MapResult to std.ouch.InputRange!limb
Oct 28 2016
On Friday, 28 October 2016 at 09:29:41 UTC, Chris wrote:On Friday, 28 October 2016 at 01:25:55 UTC, Kirill Kryukov wrote:You create the bullet in your foot for efficiency (CTFE).You shoot yourself in a tuple containing your foot, boot and sock.Cannot implicitly convert expression (map(shoot(foot))) of type MapResult to std.ouch.InputRange!limb
Oct 28 2016
On Friday, 28 October 2016 at 09:55:34 UTC, Patric Dexheimer wrote:On Friday, 28 October 2016 at 09:29:41 UTC, Chris wrote:You shoot yourself in the foot, but it doesn't matter, it was allocated on the stack.On Friday, 28 October 2016 at 01:25:55 UTC, Kirill Kryukov wrote:You create the bullet in your foot for efficiency (CTFE).You shoot yourself in a tuple containing your foot, boot and sock.Cannot implicitly convert expression (map(shoot(foot))) of type MapResult to std.ouch.InputRange!limb
Oct 28 2016
On Thursday, 27 October 2016 at 19:49:16 UTC, Ali Çehreli wrote:http://www.toodarkpark.org/computers/humor/shoot-self-in-foot.html Some entries for reference: C - 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 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." 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. What would the entry for D be? :) AliWhen you try shooting at your foot with your AK-47, you realize the GC has blown it already.
Oct 28 2016
On 10/28/2016 04:32 AM, Guillaume Piolat wrote:When you try shooting at your foot with your AK-47, you realize the GC has blown it already.Or... the bullet stops midair, waiting for the GC to finish a collection cycle (probably for a lollipop created in another thread). Ali
Oct 28 2016
On Thursday, 27 October 2016 at 19:49:16 UTC, Ali Çehreli wrote:http://www.toodarkpark.org/computers/humor/shoot-self-in-foot.html Some entries for reference: C - 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 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." 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. What would the entry for D be? :) AliYou unregister your feet from the runtime in order to move smoothly, wander in front of a bullet that's paused by the GC, which then un-pauses and hits you in the foot.
Oct 28 2016
On Friday, 28 October 2016 at 11:41:11 UTC, John Colvin wrote:You unregister your feet from the runtime in order to move smoothly, wander in front of a bullet that's paused by the GC, which then un-pauses and hits you in the foot.This is the best one so far! This is typical D: circumvent safety to enable you to shoot yourself in the foot.
Oct 28 2016
On 10/28/2016 04:41 AM, John Colvin wrote:a bullet that's paused by the GCWow. I've just said almost the same thing before reading this one. :) Ali
Oct 28 2016
as i just happened to have me mutilated, i couldn't resist (even though the example 'works' only with DMD-m64 bullets): being forced to share your foot among parallel universes, it will surely find a stray bullet in one of them. can you guess which toe is going to be blown off? ''' version(DigitalMars)version(D_LP64){ import std.stdio : writeln; import core.atomic : atomicOp; ulong toe0 = 2; shared ulong toe1 = 2; shared ulong toe2 = 2; shared ulong toe3 = 2; uint bullet1 = 1; int bullet2 = 1; ulong bullet3 = 1; toe0 -= 1; writeln( "toe0: ", toe0 ); atomicOp!"-="( toe1, bullet1 ); writeln( "toe1: ", toe1 ); atomicOp!"-="( toe2, bullet2 ); writeln( "toe2: ", toe2 ); atomicOp!"-="( toe3, bullet3 ); writeln( "toe3: ", toe3 ); } ( https://issues.dlang.org/show_bug.cgi?id=16651 )
Oct 30 2016
On 10/30/2016 04:41 PM, captaindet wrote:ulong toe0 = 2; shared ulong toe1 = 2; shared ulong toe2 = 2; shared ulong toe3 = 2;Those toes are toolong and one is already missing. Make sure that the -boundscheck compiler flag is set. :o) Ali
Oct 30 2016