Re: Fun: Shooting yourself in the foot in D

2016-10-30 Thread Ali Çehreli via Digitalmars-d

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



Re: Fun: Shooting yourself in the foot in D

2016-10-30 Thread captaindet via Digitalmars-d
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 )


Re: Fun: Shooting yourself in the foot in D

2016-10-28 Thread Ali Çehreli via Digitalmars-d

On 10/28/2016 04:41 AM, John Colvin wrote:

> a bullet that's paused by the GC

Wow. I've just said almost the same thing before reading this one. :)

Ali



Re: Fun: Shooting yourself in the foot in D

2016-10-28 Thread Ali Çehreli via Digitalmars-d

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



Re: Fun: Shooting yourself in the foot in D

2016-10-28 Thread Dominikus Dittes Scherkl via Digitalmars-d

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.


Re: Fun: Shooting yourself in the foot in D

2016-10-28 Thread John Colvin via Digitalmars-d

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? :)

Ali


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.


Re: Fun: Shooting yourself in the foot in D

2016-10-28 Thread Guillaume Piolat via Digitalmars-d

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? :)

Ali


When you try shooting at your foot with your AK-47, you realize 
the GC has blown it already.


Re: Fun: Shooting yourself in the foot in D

2016-10-28 Thread Chris via Digitalmars-d
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:
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


You create the bullet in your foot for efficiency (CTFE).


You shoot yourself in the foot, but it doesn't matter, it was 
allocated on the stack.


Re: Fun: Shooting yourself in the foot in D

2016-10-28 Thread Patric Dexheimer via Digitalmars-d

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


You create the bullet in your foot for efficiency (CTFE).


Re: Fun: Shooting yourself in the foot in D

2016-10-28 Thread Chris via Digitalmars-d

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


Re: Fun: Shooting yourself in the foot in D

2016-10-27 Thread Kirill Kryukov via Digitalmars-d

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 create some complicated template function and then compiler 
show you an ICE.


You shoot yourself in a tuple containing your foot, boot and sock.


Re: Fun: Shooting yourself in the foot in D

2016-10-27 Thread Temtaime via Digitalmars-d

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? :)

Ali


You create some complicated template function and then compiler 
show you an ICE.


Re: Fun: Shooting yourself in the foot in D

2016-10-27 Thread Ali Çehreli via Digitalmars-d

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

> You conceive a baby which is born with a bullet genetically shot in the
> foot

Like others, this one is very nice! Especially interesting to note that 
genetic and generative have the same root. :)


Ali



Re: Fun: Shooting yourself in the foot in D

2016-10-27 Thread Idan Arye via Digitalmars-d

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? :)

Ali


You conceive a baby which is born with a bullet genetically shot 
in the foot


Re: Fun: Shooting yourself in the foot in D

2016-10-27 Thread A D dev via Digitalmars-d

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? :)

Ali


1) 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.




Re: Fun: Shooting yourself in the foot in D

2016-10-27 Thread Stefan Koch via Digitalmars-d
On Thursday, 27 October 2016 at 19:59:09 UTC, Steven 
Schveighoffer wrote:

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


You would never shoot youtself in the foot. after 5 minutes the 
compiler dies with an OOM.




Re: Fun: Shooting yourself in the foot in D

2016-10-27 Thread Guillaume Boucher via Digitalmars-d
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).




Re: Fun: Shooting yourself in the foot in D

2016-10-27 Thread cym13 via Digitalmars-d
On Thursday, 27 October 2016 at 19:59:09 UTC, Steven 
Schveighoffer wrote:

On 10/27/16 3:49 PM, Ali Çehreli wrote:

[...]


You create a large meta-template library called footMassage, 
which then ends up via compiler inference compiling into a gun 
instead.


-Steve


Then the GC kicks in and triggers it.


Re: Fun: Shooting yourself in the foot in D

2016-10-27 Thread Ali Çehreli via Digitalmars-d

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



Re: Fun: Shooting yourself in the foot in D

2016-10-27 Thread Steven Schveighoffer via Digitalmars-d

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



Fun: Shooting yourself in the foot in D

2016-10-27 Thread Ali Çehreli via Digitalmars-d


  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