[Bug translator/11038] Trailing semicolon as null-statement confusing
jistone at redhat dot com
sourceware-bugzilla@sourceware.org
Tue Dec 1 17:11:00 GMT 2009
------- Additional Comments From jistone at redhat dot com 2009-12-01 17:11 -------
(In reply to comment #1)
> Created an attachment (id=4433)
--> (http://sourceware.org/bugzilla/attachment.cgi?id=4433&action=view)
> Patch to make null-statement really silent
As far as I can see, this won't change the behavior of any previously valid
scripts; it will only make a difference in this if-else case that currently
gives an error. So in that sense, your patch seems harmless.
However, I find it a little weird to squash the ';' on blocks and other
"compound" statements (if, for, foreach, while). For blocks, I think we do want
to parse "{...};" as two statements, even though it shouldn't make much
difference. For the others, a singleton body should already eat one semicolon,
so you're also eating a second. That means you could do this:
if (x) if (y) foo();; else bar()
and it will attach the 'else' to the outer 'if'. Normally you can't do that
without using braces. Perhaps that's an interesting feature, but I think
explaining the ';' rules involved would make it too weird to be very useful.
So, I think we shouldn't squash semicolons after blocks, if, for, foreach, and
while, and then the patch looks ok to me.
--
http://sourceware.org/bugzilla/show_bug.cgi?id=11038
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Systemtap
mailing list