Remove usage of CommaExp#1561
Remove usage of CommaExp#1561MartinNowak merged 1 commit intodlang:masterfrom mathias-lang-sociomantic:no-more-commaexp
Conversation
|
Bugzilla reference for bugfix? |
|
Unittests for bug fix? |
|
Updated with an issue number. But unittesting a constant doesn't really makes sense. |
|
As much as I want to remove general comma operator use support, I don't think we will ever get acceptance from @WalterBright on removing it inside |
|
@mathias-lang-sociomantic how about enabling dscanner in the build setup? |
|
Note: if we were to overtake comma operator for tuple use, We can go in stages:
|
|
I recommend splitting the PR in two, one for the fixed issue (which seems uncontroversial) and the comma thing (that seems a bit more controversial). |
The usage in There is more usage of the comma operator in
Feel free to do it, but that's not the point of this P.R.
Good points. I had a wrong memory about the proposed tuple syntax, and thought it would make the grammar ambiguous. I'll rework the DMD code to allow it in
Will do. |
By increment, I just meant the increment (3rd) expression of the for statement. |
|
Updated |
Using CommaExpression is discouraged anywhere except increment of `for` loops.
|
OK, this looks good I think. Even if we don't remove comma operators from the language in some capacity, these changes are very minor and I think the new code is clearer. |
|
LGTM |
| BOOL ListView_GetSubItemRect(HWND w, int i, int isi, int c, LPRECT p) { | ||
| return cast(BOOL) SendMessage(w, LVM_GETSUBITEMRECT, i, | ||
| p ? (p.left = c, p.top = isi, cast(LPARAM) p) : 0); | ||
| if (p) { |
This removes all usage of the comma expression in D runtime.
One of the commit is a bug fix, the second one should be no-ops.
The only useful pattern I could find for
CommaExpis withinforloops, however the cost/benefit ratio is too damn low to justify it.Ideally we should have a way to do it in a more D-ish maner, e.g.
for (; i < j; { i++; j-- })however this isn't currently inlined in-O -inlineby DMD, so I do not want to introduce such a syntax ATM.About the changes: If the condition is dependent on both the post-loop operations, I moved them together to make it more readable (see the
for->whilechange for example).