[Issue 2659] Remove the comma operator

2017-08-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2659

--- Comment #15 from github-bugzi...@puremagic.com ---
Commit pushed to dmd-cxx at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/9232e99814037727a42e0b1a646a908bde68ed40
Issue 2659 - Deprecate using the result of comma expression

--


[Issue 2659] Remove the comma operator

2016-10-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2659

--- Comment #14 from github-bugzi...@puremagic.com ---
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/058c5a301fb3942e01446a60381d5e935ab91ec7
Fix Issue 2659 - Deprecate using the result of comma expression

https://github.com/dlang/dmd/commit/0a7f87a17304c067ad42e5a25cce36c920d5b467
Merge pull request #5737 from mathias-lang-sociomantic/coma-operator-must-die

--


[Issue 2659] Remove the comma operator

2016-06-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2659

--- Comment #13 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/058c5a301fb3942e01446a60381d5e935ab91ec7
Fix Issue 2659 - Deprecate using the result of comma expression

This should weed out most of the bugs.

https://github.com/dlang/dmd/commit/0a7f87a17304c067ad42e5a25cce36c920d5b467
Merge pull request #5737 from mathias-lang-sociomantic/coma-operator-must-die

Fix Issue 2659 - Deprecate using the return of a comma expression

--


[Issue 2659] Remove the comma operator

2016-05-07 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2659

Mathias Lang  changed:

   What|Removed |Added

 CC||mathias.l...@sociomantic.co
   ||m

--- Comment #12 from Mathias Lang  ---
https://github.com/dlang/dmd/pull/5737

--


[Issue 2659] Remove the comma operator

2015-06-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2659

Andrei Alexandrescu and...@erdani.com changed:

   What|Removed |Added

Version|unspecified |D2

--


[Issue 2659] Remove the comma operator

2014-03-11 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=2659


Temtaime temta...@gmail.com changed:

   What|Removed |Added

 CC||temta...@gmail.com


--- Comment #8 from Temtaime temta...@gmail.com 2014-03-11 06:22:09 PDT ---
In some cases comma operator is useful.
I disagree with that we need to deprecate it.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 2659] Remove the comma operator

2014-03-11 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=2659


ponce alil...@gmail.com changed:

   What|Removed |Added

 CC||alil...@gmail.com


--- Comment #9 from ponce alil...@gmail.com 2014-03-11 06:27:38 PDT ---
There is evidence comma operators actively creates bugs:
In article: http://www.viva64.com/en/b/0240/
Bugs: http://www.viva64.com/en/b/0240/#ID0EXCAI
  http://www.viva64.com/en/b/0240/#ID0E4RAI

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 2659] Remove the comma operator

2014-03-11 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=2659



--- Comment #10 from bearophile_h...@eml.cc 2014-03-11 07:06:06 PDT ---
(In reply to comment #9)
 There is evidence comma operators actively creates bugs:
 In article: http://www.viva64.com/en/b/0240/
 Bugs: http://www.viva64.com/en/b/0240/#ID0EXCAI
   http://www.viva64.com/en/b/0240/#ID0E4RAI

The problems caused by the comma operator are more wider than that.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 2659] Remove the comma operator

2014-03-11 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=2659



--- Comment #11 from bearophile_h...@eml.cc 2014-03-11 07:12:54 PDT ---
(In reply to comment #8)
 In some cases comma operator is useful.
 I disagree with that we need to deprecate it.

As usual you have to weight all the advantages against all the disadvantages
and then decide.

From my experience in coding in C/D the usages of the comma operator are good
when formalized (like inside variable definitions, in function arguments, etc),
but in free/wild situations it's too much risky (and using it for tuples some
years from now is a better use).

So please try to list every one of your useful usages of the comma operator,
and let's see.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 2659] Remove the comma operator

2014-03-10 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=2659


bearophile_h...@eml.cc changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc


--- Comment #7 from bearophile_h...@eml.cc 2014-03-10 14:38:03 PDT ---
The reduction of a real bug:

bool foo(int x, int* y=null) { return true; }
void main() {
int x;
int* p;
if (foo(x), p) {
assert(0, true branch);
} else {
assert(0, false branch);
}
}


Hopefully the comma operator will be deprecated.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 2659] Remove the comma operator

2014-02-28 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=2659


Casper F�rgemand shortt...@hotmail.com changed:

   What|Removed |Added

 CC||shortt...@hotmail.com


--- Comment #4 from Casper F�rgemand shortt...@hotmail.com 2014-02-28 
01:07:10 PST ---
vec = overloaded vector type of size 3.

What I meant to write:
vec v = vec(0, 0, 3);

What I actually wrote:
vec v = (0, 0, 3);

Result:
vec v = 3; // as in vec(3, 3, 3);

It was quite nasty. Considering D doesn't allow statements like 3; I don't see
why it isn't an error to do it when using the comma operator in an assignment.
It literally just throws away everything with no side effect.

Or make it easy and just remove the comma operator completely in its current
form.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 2659] Remove the comma operator

2014-02-28 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=2659



--- Comment #5 from yebblies yebbl...@gmail.com 2014-02-28 20:13:00 EST ---
(In reply to comment #4)
 vec = overloaded vector type of size 3.
 
 What I meant to write:
 vec v = vec(0, 0, 3);
 
 What I actually wrote:
 vec v = (0, 0, 3);
 
 Result:
 vec v = 3; // as in vec(3, 3, 3);
 
 It was quite nasty. Considering D doesn't allow statements like 3; I don't see
 why it isn't an error to do it when using the comma operator in an assignment.
 It literally just throws away everything with no side effect.
 

There was an attempt in the past to error on a commaexp where the non-last
expression has no side effects, but it was never enabled because the compiler
generates thousands of these, screwing everything up.  It will probably be
added eventually.

 Or make it easy and just remove the comma operator completely in its current
 form.

That's the plan, hopefully in 2.066.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 2659] Remove the comma operator

2014-02-28 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=2659


w0rp devw...@gmail.com changed:

   What|Removed |Added

 CC||devw...@gmail.com


--- Comment #6 from w0rp devw...@gmail.com 2014-02-28 01:18:35 PST ---
+1 to this. Also, I wouldn't use a comma in future for tuple syntax with
parentheses. I think that was a mistake in Python. Supposing this was
translated to D as it is in Python...

auto x = (); // empty tuple
auto x = (1); // value 1
auto x = (1,) // tuple of size 1
auto x = (1, 2) // pair

After so many years, I still make mistakes regularly with this.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 2659] Remove the comma operator

2014-02-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=2659


yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 CC||yebbl...@gmail.com


--- Comment #3 from yebblies yebbl...@gmail.com 2014-02-05 23:46:48 EST ---
https://github.com/D-Programming-Language/druntime/pull/716
https://github.com/D-Programming-Language/phobos/pull/1908

Caught 1 bug!

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 2659] Remove the comma operator

2012-10-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2659



--- Comment #2 from Don clugd...@yahoo.com.au 2012-10-23 07:45:53 PDT ---
Just encountered another newbie reason for removing comma.

writeln( 6, mixin(7,8), 9 );

doesn't print the expected 6 7 8 9. Instead it prints 6 8 9.

If comma was removed, this wouldn't compile.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 2659] Remove the comma operator

2009-02-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2659





--- Comment #1 from wbax...@gmail.com  2009-02-16 19:10 ---
(In reply to comment #0)
 The comma operator is an unintuitive operator with very few commendable uses.

About the only real use it gets in C is in preprocessor macro hacks.  And we
all know D's stance on preprocessing.

 If comma were added to the increment grammar of the for loop,
 the comma operator could be removed from the language.

Or put to better purpose making (a,b,c) a literal tuple syntax.


--