[Issue 1053] New: Make 'static else if' or 'static if (...) {...} else if' work
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Mar 11 11:28:17 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1053
Summary: Make 'static else if' or 'static if (...) {...} else if'
work
Product: D
Version: 1.008
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: wbaxter at gmail.com
It would be nice if "else static if" could be written "static else if". Or
even better just "else if".
"else static if" struck me as odd the first time I saw it, and since then I
continue to mistype it as "static else if" pretty much every time I use it.
So it would be great if "static else if" just worked.
On the other hand, I'm pretty sure
static if (foo) { }
else if (bar) { }
is an error currently, so it would be nice if that were just taken to be a
"static else if". There isn't a "static else {}" so why should we have to
repeat the "static" on an "else if"? One "static" should be enough.
I guess this could be an issue?:
static if (foo)
if (biff)
single_statement();
else if (bar) { }
But I could live without being able to do that. Oh, and besides that it's
already ambiguous with plain ifs...
if (foo)
if (biff)
single_statement();
else if (bar) { }
Exactly the same deal -- who does the else belong to?
--
As an added bonus either of these changes would make the Emacs D-mode capable
of indenting static ifs with else ifs properly. That's not a sufficient reason
to make the change (emacs D-mode could be made to work somehow) But the fact
that cc-mode basically sees "else static if" as an aberration was the thing
that finally drove me to file an enhancement request on this.
--
More information about the Digitalmars-d-bugs
mailing list