This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug translator/11038] Trailing semicolon as null-statement confusing


------- 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]