Re: [Bro-Dev] Pattern matching for the Bro language

2015-08-20 Thread Robin Sommer
On Wed, Aug 19, 2015 at 08:43 -0700, you wrote: switch( f() ) { case addr: if ( x in 10.0.0.0/8 ) result = got it!; case string: result = f() failed: + x; } Had discussed this with Matthias before, but for the record: I like it,

Re: [Bro-Dev] Pattern matching for the Bro language

2015-08-20 Thread Seth Hall
On Aug 20, 2015, at 11:15 AM, Robin Sommer ro...@icir.org wrote: Had discussed this with Matthias before, but for the record: I like it, too. :-) (This form; less the one with return values, at least for now). I like this proposal a lot too. .Seth -- Seth Hall International Computer

[Bro-Dev] Pattern matching for the Bro language

2015-08-19 Thread Matthias Vallentin
TL;DR: function f() : any; local result = ; switch( f() ) { case addr: if ( x in 10.0.0.0/8 ) result = got it!; case string: result = f() failed: + x; } I want to propose introducing pattern matching for the Bro language. Pattern

Re: [Bro-Dev] Pattern matching for the Bro language

2015-08-19 Thread Vern Paxson
I want to propose introducing pattern matching for the Bro language. Per our discussion yesterday, I like this notion in general. (Seems we need a better term for it, though, as pattern matching is very generic - plus will confuse some people who'll think it refers to NIDS rules rather than

Re: [Bro-Dev] Pattern matching for the Bro language

2015-08-19 Thread Matthias Vallentin
local result = switch( x ) { case T: case U: }; Personally, this strike me as a tad weird, since now result might not have a statically determined type, so we're back to it being any. To avoid falling back to any land, the additional constraint