public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "jistone at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sources.redhat.com
Subject: [Bug translator/11038] Trailing semicolon as null-statement confusing
Date: Tue, 01 Dec 2009 17:11:00 -0000	[thread overview]
Message-ID: <20091201171100.23626.qmail@sourceware.org> (raw)
In-Reply-To: <20091201102145.11038.mjw@redhat.com>


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

  parent reply	other threads:[~2009-12-01 17:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-01 10:21 [Bug translator/11038] New: " mjw at redhat dot com
2009-12-01 10:23 ` [Bug translator/11038] " mjw at redhat dot com
2009-12-01 17:11 ` jistone at redhat dot com [this message]
2009-12-21 21:40 ` mjw at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091201171100.23626.qmail@sourceware.org \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).