public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/11473] New: Support optional "as VALUE" in foreach loops
@ 2010-04-06 22:08 jistone at redhat dot com
  2010-04-06 22:16 ` [Bug translator/11473] " jistone at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: jistone at redhat dot com @ 2010-04-06 22:08 UTC (permalink / raw)
  To: systemtap

The current foreach syntax is:

  foreach (VAR in ARRAY [ limit EXP ]) STMT
  foreach ([VAR1, VAR2, ...] in ARRAY [ limit EXP ]) STMT

I propose making it:

  foreach (VAR in ARRAY [ as VALUE ] [ limit EXP ]) STMT
  foreach ([VAR1, VAR2, ...] in ARRAY [ as VALUE ] [ limit EXP ]) STMT

This way we can avoid repeated array lookups for the common case that you're
only interested in ARRAY[VAR1,VAR2,...] anyway.

-- 
           Summary: Support optional "as VALUE" in foreach loops
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: translator
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: jistone at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=11473

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug translator/11473] Support optional "as VALUE" in foreach loops
  2010-04-06 22:08 [Bug translator/11473] New: Support optional "as VALUE" in foreach loops jistone at redhat dot com
@ 2010-04-06 22:16 ` jistone at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: jistone at redhat dot com @ 2010-04-06 22:16 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From jistone at redhat dot com  2010-04-06 22:16 -------
I hesitate to make "as" a full-blown keyword, as even in the testsuite there are
instances of "as" being a variable.  But since this proposed use is fully
contextual, I think it's ok to act like a foreach-only keyword.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|systemtap at sources dot    |jistone at redhat dot com
                   |redhat dot com              |
             Status|NEW                         |ASSIGNED


http://sourceware.org/bugzilla/show_bug.cgi?id=11473

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-06 22:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-06 22:08 [Bug translator/11473] New: Support optional "as VALUE" in foreach loops jistone at redhat dot com
2010-04-06 22:16 ` [Bug translator/11473] " jistone at redhat dot com

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