Thread overview | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
December 19, 2011 [Issue 7133] New: [tdpl] There should be no empty statement | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=7133 Summary: [tdpl] There should be no empty statement Product: D Version: D2 Platform: Other OS/Version: Mac OS X Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: andrei@metalanguage.com --- Comment #0 from Andrei Alexandrescu <andrei@metalanguage.com> 2011-12-18 18:17:17 PST --- The statement ";" should not exist. It is never needed, never useful, and in most cases the compiler requires it to be replaced with '{}'. Walter and I agreed on all of the above so ";" is not present in TDPL. It should be slowly deprecated and ultimately removed from D. It is just junk in the trunk. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 19, 2011 [Issue 7133] [tdpl] There should be no empty statement | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | http://d.puremagic.com/issues/show_bug.cgi?id=7133 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg@gmx.com --- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2011-12-18 18:25:35 PST --- The one case that I'm aware of where some have argued for its value is labels. e.g. LABEL:; Since labels require a statement, ; makes it so that you can you can use a label without really having a statement. I'm not sure that that merits keeping it however, since in every other use case that I can think of, it has no value. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 19, 2011 [Issue 7133] [tdpl] There should be no empty statement | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | http://d.puremagic.com/issues/show_bug.cgi?id=7133 --- Comment #3 from Jonathan M Davis <jmdavisProg@gmx.com> 2011-12-18 18:28:18 PST --- I didn't think that that worked, since {} isn't a statement (at least, as far as I know, it isn't), but if it works, it's certainly better. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 19, 2011 [Issue 7133] [tdpl] There should be no empty statement | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | http://d.puremagic.com/issues/show_bug.cgi?id=7133 --- Comment #4 from Andrei Alexandrescu <andrei@metalanguage.com> 2011-12-18 20:06:48 PST --- {} is the empty statement in D. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 19, 2011 [Issue 7133] [tdpl] There should be no empty statement | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | http://d.puremagic.com/issues/show_bug.cgi?id=7133 --- Comment #5 from Jonathan M Davis <jmdavisProg@gmx.com> 2011-12-18 20:11:40 PST --- Is that different from C++? I thought that {} was just an empty scope without any statements in it at all in both C/C++ and D. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 19, 2011 [Issue 7133] [tdpl] There should be no empty statement | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | http://d.puremagic.com/issues/show_bug.cgi?id=7133 Stewart Gordon <smjg@iname.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg@iname.com Platform|Other |All OS/Version|Mac OS X |All Severity|normal |enhancement --- Comment #6 from Stewart Gordon <smjg@iname.com> 2011-12-19 05:07:21 PST --- (In reply to comment #5) > Is that different from C++? I thought that {} was just an empty scope without any statements in it at all in both C/C++ and D. It is, but in 100% of cases the compiler can optimise away that empty scope and so it's equivalent to an empty statement. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 19, 2011 [Issue 7133] [tdpl] There should be no empty statement | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | http://d.puremagic.com/issues/show_bug.cgi?id=7133 jakobovrum@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakobovrum@gmail.com --- Comment #7 from jakobovrum@gmail.com 2011-12-19 05:16:39 PST --- (In reply to comment #3) > I didn't think that that worked, since {} isn't a statement (at least, as far as I know, it isn't), but if it works, it's certainly better. It is indeed a statement, it's called a block statement, also in D: http://dlang.org/statement.html#BlockStatement -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 19, 2011 [Issue 7133] [tdpl] There should be no empty statement | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | http://d.puremagic.com/issues/show_bug.cgi?id=7133 timon.gehr@gmx.ch changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |timon.gehr@gmx.ch --- Comment #8 from timon.gehr@gmx.ch 2011-12-19 06:23:35 PST --- (In reply to comment #0) > The statement ";" should not exist. It is never needed, never useful, and in most cases the compiler requires it to be replaced with '{}'. > > Walter and I agreed on all of the above so ";" is not present in TDPL. It should be slowly deprecated and ultimately removed from D. It is just junk in the trunk. I think it is useful. This looks odd: int i = 2; for({} i<2; i++){} -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 19, 2011 [Issue 7133] [tdpl] There should be no empty statement | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | http://d.puremagic.com/issues/show_bug.cgi?id=7133 --- Comment #9 from Stewart Gordon <smjg@iname.com> 2011-12-19 07:17:31 PST --- (In reply to comment #8) > I think it is useful. This looks odd: > > int i = 2; > for({} i<2; i++){} The ; you're replacing there isn't a statement - it's something explicitly allowed by the ForStatement syntax. ForStatement: for (Initialize Testopt ; Incrementopt) ScopeStatement Initialize: ; NoScopeNonEmptyStatement -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 24, 2011 [Issue 7133] [tdpl] There should be no empty statement | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | http://d.puremagic.com/issues/show_bug.cgi?id=7133 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug@yahoo.com.au --- Comment #10 from Don <clugdbug@yahoo.com.au> 2011-12-24 04:41:20 PST --- (In reply to comment #2) > LABEL: {} > > is as good and marginally nicer. Bear in mind that it only ever happens at the end of a block, so the next character is always a }. The existing label syntax needs to be retained for asm statements, though, since they don't have {}. asm { jmp done; done: ; } which is already ugly, and will look really silly when nude ; statements are gone. I wish we could get rid of that silly semicolon. In fact the oddity is that labels are considered to be statements, yet they don't end with a semicolon. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation