[Bro-Dev] [JIRA] (BIT-1315) Teach Bro how to 'while'

2015-02-20 Thread Robin Sommer (JIRA)

 [ 
https://bro-tracker.atlassian.net/browse/BIT-1315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robin Sommer updated BIT-1315:
--
Resolution: Merged  (was: Fixed)
Status: Closed  (was: Merge Request)

> Teach Bro how to 'while'
> 
>
> Key: BIT-1315
> URL: https://bro-tracker.atlassian.net/browse/BIT-1315
> Project: Bro Issue Tracker
>  Issue Type: New Feature
>  Components: Bro
>Reporter: Jon Siwek
>Assignee: Robin Sommer
>Priority: Low
> 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
(v6.4-OD-14-082#64012)
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


[Bro-Dev] [JIRA] (BIT-1315) Teach Bro how to 'while'

2015-02-17 Thread Robin Sommer (JIRA)

 [ 
https://bro-tracker.atlassian.net/browse/BIT-1315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robin Sommer reassigned BIT-1315:
-

Assignee: Robin Sommer

> Teach Bro how to 'while'
> 
>
> Key: BIT-1315
> URL: https://bro-tracker.atlassian.net/browse/BIT-1315
> Project: Bro Issue Tracker
>  Issue Type: New Feature
>  Components: Bro
>Reporter: Jon Siwek
>Assignee: Robin Sommer
>Priority: Low
> 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
(v6.4-OD-14-082#64012)
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


[Bro-Dev] [JIRA] (BIT-1315) Teach Bro how to 'while'

2015-02-17 Thread Robin Sommer (JIRA)

 [ 
https://bro-tracker.atlassian.net/browse/BIT-1315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robin Sommer updated BIT-1315:
--

For the record: I'm for it, too. :)

Will merge.






> Teach Bro how to 'while'
> 
>
> Key: BIT-1315
> URL: https://bro-tracker.atlassian.net/browse/BIT-1315
> Project: Bro Issue Tracker
>  Issue Type: New Feature
>  Components: Bro
>Reporter: Jon Siwek
>Priority: Low
> 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
(v6.4-OD-14-082#64012)
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


Re: [Bro-Dev] [JIRA] (BIT-1315) Teach Bro how to 'while'

2015-02-17 Thread Robin Sommer
For the record: I'm for it, too. :)

Will merge.

On Sun, Feb 15, 2015 at 22:14 -0600, you wrote:

> 
>  [ 
> https://bro-tracker.atlassian.net/browse/BIT-1315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
>  ]
> 
> Seth Hall updated BIT-1315:
> ---
> 
> 
> Let’s go ahead and merge it then. :)
> 
> 
> > Teach Bro how to 'while'
> > 
> >
> > Key: BIT-1315
> > URL: https://bro-tracker.atlassian.net/browse/BIT-1315
> > Project: Bro Issue Tracker
> >  Issue Type: New Feature
> >  Components: Bro
> >Reporter: Jon Siwek
> >Priority: Low
> > 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
> (v6.4-OD-14-082#64012)
> 
> ___
> bro-dev mailing list
> bro-dev@bro.org
> http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev
> 


___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


[Bro-Dev] [JIRA] (BIT-1315) Teach Bro how to 'while'

2015-02-15 Thread Seth Hall (JIRA)

 [ 
https://bro-tracker.atlassian.net/browse/BIT-1315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Seth Hall updated BIT-1315:
---


Let’s go ahead and merge it then. :)


> Teach Bro how to 'while'
> 
>
> Key: BIT-1315
> URL: https://bro-tracker.atlassian.net/browse/BIT-1315
> Project: Bro Issue Tracker
>  Issue Type: New Feature
>  Components: Bro
>Reporter: Jon Siwek
>Priority: Low
> 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
(v6.4-OD-14-082#64012)

___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


[Bro-Dev] [JIRA] (BIT-1315) Teach Bro how to 'while'

2015-02-15 Thread Vern Paxson (JIRA)

[ 
https://bro-tracker.atlassian.net/browse/BIT-1315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19608#comment-19608
 ] 

Vern Paxson commented on BIT-1315:
--

I'm okay with this addition, too.  If we want to think about more elegant forms 
for down the road, I'd suggest studying the use of "generators" in the 
(now-long-out-of-use) "Icon" programming language.  These enable expressing all 
sorts of iterative computation in concise-but-readable ways.

> Teach Bro how to 'while'
> 
>
> Key: BIT-1315
> URL: https://bro-tracker.atlassian.net/browse/BIT-1315
> Project: Bro Issue Tracker
>  Issue Type: New Feature
>  Components: Bro
>Reporter: Jon Siwek
>Priority: Low
> 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
(v6.4-OD-14-082#64012)
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


[Bro-Dev] [JIRA] (BIT-1315) Teach Bro how to 'while'

2015-02-13 Thread Seth Hall (JIRA)

 [ 
https://bro-tracker.atlassian.net/browse/BIT-1315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Seth Hall updated BIT-1315:
---


Agreed.  I’ve had the same debate with myself plenty of times.


Yeah.  It would remove some pretty hacky looking code in scripts too.

I guess I could see adding it.  I’ll be updating a few scripts if it does end 
up going into master. :)

  .Seth


> Teach Bro how to 'while'
> 
>
> Key: BIT-1315
> URL: https://bro-tracker.atlassian.net/browse/BIT-1315
> Project: Bro Issue Tracker
>  Issue Type: New Feature
>  Components: Bro
>Reporter: Jon Siwek
>Priority: Low
> 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
(v6.4-OD-14-082#64012)

___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


[Bro-Dev] [JIRA] (BIT-1315) Teach Bro how to 'while'

2015-02-13 Thread Jon Siwek (JIRA)

[ 
https://bro-tracker.atlassian.net/browse/BIT-1315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19606#comment-19606
 ] 

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

For a specific example I ran in to when making the API in to Broker's data 
stores:

https://github.com/bro/bro/blob/topic/jsiwek/broker/testing/btest/comm/data.bro

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'
> 
>
> Key: BIT-1315
> URL: https://bro-tracker.atlassian.net/browse/BIT-1315
> Project: Bro Issue Tracker
>  Issue Type: New Feature
>  Components: Bro
>Reporter: Jon Siwek
>Priority: Low
> 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
(v6.4-OD-14-082#64012)
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


[Bro-Dev] [JIRA] (BIT-1315) Teach Bro how to 'while'

2015-02-13 Thread Seth Hall (JIRA)

[ 
https://bro-tracker.atlassian.net/browse/BIT-1315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19605#comment-19605
 ] 

Seth Hall commented on BIT-1315:


Do you think we should think about this a bit more and see if we can figure out 
an elegant way to present an evented looping construct to users?  It's 
currently possible to do evented loops, but it's certainly inelegant.

It would be really nice to be able to do loops in Bro that last the entire 
duration of the Bro process but that would definitely necessitate a different 
approach.

> Teach Bro how to 'while'
> 
>
> Key: BIT-1315
> URL: https://bro-tracker.atlassian.net/browse/BIT-1315
> Project: Bro Issue Tracker
>  Issue Type: New Feature
>  Components: Bro
>Reporter: Jon Siwek
>Priority: Low
> 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
(v6.4-OD-14-082#64012)
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


[Bro-Dev] [JIRA] (BIT-1315) Teach Bro how to 'while'

2015-02-13 Thread Jon Siwek (JIRA)

 [ 
https://bro-tracker.atlassian.net/browse/BIT-1315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jon Siwek updated BIT-1315:
---
Status: Merge Request  (was: Open)

> Teach Bro how to 'while'
> 
>
> Key: BIT-1315
> URL: https://bro-tracker.atlassian.net/browse/BIT-1315
> Project: Bro Issue Tracker
>  Issue Type: New Feature
>  Components: Bro
>Reporter: Jon Siwek
>Priority: Low
> 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
(v6.4-OD-14-082#64012)
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


[Bro-Dev] [JIRA] (BIT-1315) Teach Bro how to 'while'

2015-02-13 Thread Jon Siwek (JIRA)
Jon Siwek created BIT-1315:
--

 Summary: Teach Bro how to 'while'
 Key: BIT-1315
 URL: https://bro-tracker.atlassian.net/browse/BIT-1315
 Project: Bro Issue Tracker
  Issue Type: New Feature
  Components: Bro
Reporter: Jon Siwek
Priority: Low
 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
(v6.4-OD-14-082#64012)
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev