Problem with using as shorthand for if

2010-08-20 Thread Ersin Er
Hi, The following code compiles and outputs 1 = 1 as expected: 1 == 1 writeln(1 = 1); However, the following code fails to compile (although it should not): 1 == 2 writeln(1 = 2); The error is as follows: Error: integral constant must be scalar type, not void What I expect that the second

Re: Problem with using as shorthand for if

2010-08-20 Thread Jonathan M Davis
On Friday, August 20, 2010 13:06:11 div0 wrote: On 20/08/2010 20:59, Ersin Er wrote: Hi, The following code compiles and outputs 1 = 1 as expected: 1 == 1 writeln(1 = 1); However, the following code fails to compile (although it should not): 1 == 2 writeln(1 = 2); The

Re: Problem with using as shorthand for if

2010-08-20 Thread Iain Buclaw
== Quote from Ersin Er (ersin...@gmail.com)'s article Hi, The following code compiles and outputs 1 = 1 as expected: 1 == 1 writeln(1 = 1); However, the following code fails to compile (although it should not): 1 == 2 writeln(1 = 2); The error is as follows: Error: integral constant must

Re: Problem with using as shorthand for if

2010-08-20 Thread div0
On 20/08/2010 21:16, Jonathan M Davis wrote: It's legal according to TDPL. It seems to be intended to be used as a shorthand for if. So, stuff like condition writeln(my output); are supposed to be perfectly legal as bizarre as that may seem. I don't believe that it would be legal to do

Re: Problem with using as shorthand for if

2010-08-20 Thread Jonathan M Davis
On Friday, August 20, 2010 14:00:22 div0 wrote: Then Andrei has taken leave of his senses and this is one situation where DMD is corrent and TDPL is wrong. Half arsed, moronic shortcuts like that belong in scripting languages and shell environements, not serious programming languages. Well,

Re: Problem with using as shorthand for if

2010-08-20 Thread Ersin Er
On Sat, Aug 21, 2010 at 00:00, div0 d...@sourceforge.net wrote: On 20/08/2010 21:16, Jonathan M Davis wrote: It's legal according to TDPL. It seems to be intended to be used as a shorthand for if. So, stuff like condition writeln(my output); are supposed to be perfectly legal as

Re: Problem with using as shorthand for if

2010-08-20 Thread Ersin Er
On Fri, Aug 20, 2010 at 23:06, div0 d...@sourceforge.net wrote: On 20/08/2010 20:59, Ersin Er wrote: Hi, The following code compiles and outputs 1 = 1 as expected: 1 == 1 writeln(1 = 1); However, the following code fails to compile (although it should not): 1 == 2 writeln(1 = 2);

Re: Problem with using as shorthand for if

2010-08-20 Thread bearophile
Jonathan M Davis: Well, Andrei is definitely a fan of using D for small scripts, so arguments that something shouldn't be done because it's intended for scripting aren't going to fly with him. Personally, I find it a bit weird, but I don't really care. I probably won't code that way,

Re: Problem with using as shorthand for if

2010-08-20 Thread Jonathan M Davis
On Friday, August 20, 2010 15:32:16 bearophile wrote: Jonathan M Davis: Well, Andrei is definitely a fan of using D for small scripts, so arguments that something shouldn't be done because it's intended for scripting aren't going to fly with him. Personally, I find it a bit weird, but I