Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-23 Thread Yota via Digitalmars-d
On Tuesday, 15 July 2014 at 17:26:12 UTC, Tofu Ninja wrote: On Tuesday, 15 July 2014 at 17:09:14 UTC, H. S. Teoh via Digitalmars-d wrote: On Tue, Jul 15, 2014 at 04:52:34PM +, Israel Rodriguez via Digitalmars-d wrote: [...] Nuh uh...The comma operator is too valuable to loose... Please

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-23 Thread sigod via Digitalmars-d
On Wednesday, 23 July 2014 at 17:25:43 UTC, Yota wrote: It appears Microsoft is musing the idea of adding this operator to C# and VB.Net. Only instead of it being a comma, they're going with a semicolon.

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-23 Thread Ali Çehreli via Digitalmars-d
On 07/23/2014 10:59 AM, sigod wrote: On Wednesday, 23 July 2014 at 17:25:43 UTC, Yota wrote: It appears Microsoft is musing the idea of adding this operator to C# and VB.Net. Only instead of it being a comma, they're going with a semicolon.

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-23 Thread H. S. Teoh via Digitalmars-d
On Wed, Jul 23, 2014 at 12:04:52PM -0700, Ali Çehreli via Digitalmars-d wrote: [...] Reminds me... Is everybody aware of D's for syntax? import std.stdio; void main() { for ( { int i = 42; double d = 1.5; string s = hello; } i 100; i *=

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-23 Thread Yota via Digitalmars-d
On Wednesday, 23 July 2014 at 17:59:42 UTC, sigod wrote: On Wednesday, 23 July 2014 at 17:25:43 UTC, Yota wrote: It appears Microsoft is musing the idea of adding this operator to C# and VB.Net. Only instead of it being a comma, they're going with a semicolon.

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-23 Thread Meta via Digitalmars-d
On Wednesday, 23 July 2014 at 19:04:52 UTC, Ali Çehreli wrote: Reminds me... Is everybody aware of D's for syntax? import std.stdio; void main() { for ( { int i = 42; double d = 1.5; string s = hello; } i 100; i *= 2) { writefln(In the

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-23 Thread Ali Çehreli via Digitalmars-d
On 07/23/2014 12:04 PM, Ali Çehreli wrote: On 07/23/2014 10:59 AM, sigod wrote: On Wednesday, 23 July 2014 at 17:25:43 UTC, Yota wrote: It appears Microsoft is musing the idea of adding this operator to C# and VB.Net. Only instead of it being a comma, they're going with a semicolon.

The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread Meta via Digitalmars-d
Spot the bug: template flattenedType(R, uint depth = uint.max) if (isInputRange!R) { static if (depth 0) { static if (!isInputRange!(typeof(R.init.front))) { alias flattenedType = typeof(R.init.front, depth - 1);

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread Martin Krejcirik via Digitalmars-d
On Tuesday, 15 July 2014 at 08:01:40 UTC, Meta wrote: I'll give you a hint: the bug causes flattenedType!R to always returned uint. What is unexpected about that ?

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread Meta via Digitalmars-d
On Tuesday, 15 July 2014 at 08:20:34 UTC, Martin Krejcirik wrote: On Tuesday, 15 July 2014 at 08:01:40 UTC, Meta wrote: I'll give you a hint: the bug causes flattenedType!R to always returned uint. What is unexpected about that ? It makes the behaviour of the template that's unexpected.

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread bearophile via Digitalmars-d
Meta: Spot the bug: We can start killing those commas in D 2.067 :-) Bye, bearophile

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread H. S. Teoh via Digitalmars-d
On Tue, Jul 15, 2014 at 08:42:17AM +, bearophile via Digitalmars-d wrote: Meta: Spot the bug: We can start killing those commas in D 2.067 :-) [...] Is that the agreed-on schedule? I'd love to see the comma operator go, too, but I don't recall the core devs agreeing on a deprecation

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread Frustrated via Digitalmars-d
On Tuesday, 15 July 2014 at 08:01:40 UTC, Meta wrote: Spot the bug: template flattenedType(R, uint depth = uint.max) if (isInputRange!R) { static if (depth 0) { static if (!isInputRange!(typeof(R.init.front))) { alias

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread Meta via Digitalmars-d
On Tuesday, 15 July 2014 at 16:01:37 UTC, Frustrated wrote: This isn't a bug! It's a logic mistake. Why the heck would you have such a line anyways? alias flattenedType = typeof(R.init.front, depth - 1); The 2nd argument to typeof makes no sense. It shouldn't be on that line at all. Total

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread Andrej Mitrovic via Digitalmars-d
On 7/15/14, Frustrated via Digitalmars-d digitalmars-d@puremagic.com wrote: On Tuesday, 15 July 2014 at 08:01:40 UTC, Meta wrote: The 2nd argument to typeof makes no sense. It shouldn't be on that line at all. Total fail by the programmer. Well yeah, real world programmers make mistakes.

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread Jane Doe via Digitalmars-d
On Tuesday, 15 July 2014 at 16:16:19 UTC, Andrej Mitrovic via Digitalmars-d wrote: On 7/15/14, Frustrated via Digitalmars-d digitalmars-d@puremagic.com wrote: On Tuesday, 15 July 2014 at 08:01:40 UTC, Meta wrote: The 2nd argument to typeof makes no sense. It shouldn't be on that line at all.

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread Israel Rodriguez via Digitalmars-d
On Tuesday, 15 July 2014 at 08:01:40 UTC, Meta wrote: Spot the bug: template flattenedType(R, uint depth = uint.max) if (isInputRange!R) { static if (depth 0) { static if (!isInputRange!(typeof(R.init.front))) { alias

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread John Colvin via Digitalmars-d
On Tuesday, 15 July 2014 at 16:45:02 UTC, Jane Doe wrote: On Tuesday, 15 July 2014 at 16:16:19 UTC, Andrej Mitrovic via Digitalmars-d wrote: On 7/15/14, Frustrated via Digitalmars-d digitalmars-d@puremagic.com wrote: On Tuesday, 15 July 2014 at 08:01:40 UTC, Meta wrote: The 2nd argument to

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread bearophile via Digitalmars-d
Jane Doe: So, you wanna nerf everything that could produce the wrong behavior? A smarter question is: How to reduce the number of bugs in D code decreasing the language functionality only very little, and keeping the language handy (or making it even more handy)? There is nothing in this

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread Martin Krejcirik via Digitalmars-d
The reason for getting rid of it is because it's borderline useless. It causes more accidental bugs than it enables deliberate uses. I find the comma op useful somemtimes. This example shows absolutely nothing of comma wrongdoing. If anything, there could be a warning for passing signed

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread Andrej Mitrovic via Digitalmars-d
On 7/15/14, Jane Doe via Digitalmars-d digitalmars-d@puremagic.com wrote: Should be reduce the speed limit to 5mph because cars can kill people? No but maybe we should reduce the number of different accounts a single person can use to troll around these forums.

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread H. S. Teoh via Digitalmars-d
On Tue, Jul 15, 2014 at 04:52:34PM +, Israel Rodriguez via Digitalmars-d wrote: [...] Nuh uh...The comma operator is too valuable to loose... Please cite an example where it is valuable? T -- Without outlines, life would be pointless.

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread bearophile via Digitalmars-d
Martin Krejcirik: I find the comma op useful somemtimes. Please shows us all the cases you can think of (or coming from your own code, or coming from the Web) where you think it's useful. This example shows absolutely nothing of comma wrongdoing. See my precedent answer. If

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread H. S. Teoh via Digitalmars-d
On Tue, Jul 15, 2014 at 05:03:21PM +, Martin Krejcirik via Digitalmars-d wrote: The reason for getting rid of it is because it's borderline useless. It causes more accidental bugs than it enables deliberate uses. I find the comma op useful somemtimes. Example? T -- Don't drink and

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread Tofu Ninja via Digitalmars-d
On Tuesday, 15 July 2014 at 17:09:14 UTC, H. S. Teoh via Digitalmars-d wrote: On Tue, Jul 15, 2014 at 04:52:34PM +, Israel Rodriguez via Digitalmars-d wrote: [...] Nuh uh...The comma operator is too valuable to loose... Please cite an example where it is valuable? T Yes please, I

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread Martin Krejcirik via Digitalmars-d
Example? For loop with multiple variables and various one liners of questionable utility aside: import std.stdio; bool funk() { static int count; return ++count 1 ? true : false; } void main() { bool flag = false; if (flag funk) writeln(a); else if

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread Meta via Digitalmars-d
On Tuesday, 15 July 2014 at 17:26:12 UTC, Tofu Ninja wrote: Yes please, I legitimately can't think of any use case. I don't understand why was this was ever introduced to D? What is the use? C compatibility as far as I know.

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread H. S. Teoh via Digitalmars-d
On Tue, Jul 15, 2014 at 05:26:11PM +, Tofu Ninja via Digitalmars-d wrote: On Tuesday, 15 July 2014 at 17:09:14 UTC, H. S. Teoh via Digitalmars-d wrote: On Tue, Jul 15, 2014 at 04:52:34PM +, Israel Rodriguez via Digitalmars-d wrote: [...] Nuh uh...The comma operator is too valuable to

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread Meta via Digitalmars-d
On Tuesday, 15 July 2014 at 18:08:15 UTC, Martin Krejcirik wrote: Example? For loop with multiple variables and various one liners of questionable utility aside: import std.stdio; bool funk() { static int count; return ++count 1 ? true : false; } void main() { bool flag =

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread Ali Çehreli via Digitalmars-d
On 07/15/2014 11:08 AM, Martin Krejcirik wrote: Example? For loop with multiple variables and various one liners of questionable utility aside: import std.stdio; bool funk() { static int count; return ++count 1 ? true : false; } void main() { bool flag = false; if

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread John Colvin via Digitalmars-d
On Tuesday, 15 July 2014 at 18:08:15 UTC, Martin Krejcirik wrote: Example? For loop with multiple variables and various one liners of questionable utility aside: import std.stdio; bool funk() { static int count; return ++count 1 ? true : false; } void main() { bool flag =

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread Brian Schott via Digitalmars-d
On Tuesday, 15 July 2014 at 18:50:08 UTC, John Colvin wrote: The comma operators entire job is to inject state changes where the reader doesn't expect them. It's a misfeature of C that we've sadly inherited and should rid ourselves from.

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread Martin Krejcirik via Digitalmars-d
On Tuesday, 15 July 2014 at 18:50:08 UTC, John Colvin wrote: and not just because I don't like the comma. I'd say it's generally bad practice to hide that write to `flag` inside the You are right for the 'final' code, but the point of my example is, that I can move the flag to another if and

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread bearophile via Digitalmars-d
Martin Krejcirik: Also an assignment is not allowed in a condition and without the comma operator, it wouldn't be possible at all. That's way too restrictive. If I find code like yours, I refactor it ASAP :-) Bye, bearophile

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread H. S. Teoh via Digitalmars-d
On Tue, Jul 15, 2014 at 07:16:17PM +, Martin Krejcirik via Digitalmars-d wrote: On Tuesday, 15 July 2014 at 18:50:08 UTC, John Colvin wrote: and not just because I don't like the comma. I'd say it's generally bad practice to hide that write to `flag` inside the You are right for the

Re: The Comma Operator's Deprecation Can't Come Soon Enough

2014-07-15 Thread H. S. Teoh via Digitalmars-d
On Tue, Jul 15, 2014 at 12:46:04PM -0700, H. S. Teoh via Digitalmars-d wrote: On Tue, Jul 15, 2014 at 07:16:17PM +, Martin Krejcirik via Digitalmars-d wrote: On Tuesday, 15 July 2014 at 18:50:08 UTC, John Colvin wrote: and not just because I don't like the comma. I'd say it's generally