Jon Siwek commented on BIT-1315:
Distributing work over time via a recurring event isn't the same thing, though.
I don't mind if this gets postponed or even just rejected. I mostly made the patch
for my own interest (didn't take long) and just to see the reaction -- I'm not
actually sure I've seen any arguments that make me think it's completely a bad
idea. What I don't like is that it feels as if this aspect of the language comes
from the assumption that the programmer doesn't know what they're doing. And
that doesn't make it fun when it comes time to work around it and or try to explain
the absence to someone.
To summarize my reasoning: I think there are cases where something like a "while
loop" is an efficient way to get things done and I would at least like to be able to
decide for myself whether it's reasonable or too dangerous to use for a particular
For a specific example I ran in to when making the API in to Broker's data stores:
For that I guess I'm in a position where I can modify Bro's core to make
"for" loops aware of the new opaque type, but special-casing doesn't feel
great -- essentially what I've made is Bro bindings for the Broker library and the
least stuff I have to modify in the core language the better because it sort of proves the
possibility of making Bro bindings for other libraries as isolated plugins.
Teach Bro how to 'while'
Project: Bro Issue Tracker
Issue Type: New Feature
Reporter: Jon Siwek
Fix For: 2.4
topic/jsiwek/while has an implementation of a general purpose 'while' loop. If
one wants to hack around the current limitation of only looping over collections,
they're going to do it (e.g. recursion), so why not just provide a more convenient
way instead? The mess you have to write to work around the limitation may be more
error-prone than just providing a simple while loop.
An alternative to adding 'while' to the language might be to allow "for
()" to be an unbounded loop and force the author to put the necessary break/return
conditions in the body.
This message was sent by Atlassian JIRA