[Bro-Dev] Pattern matching for the Bro language

Robin Sommer robin at icir.org
Thu Aug 20 08:15:31 PDT 2015

On Wed, Aug 19, 2015 at 08:43 -0700, you wrote:

>     switch( f() )
>       {
>       case addr:
>         if ( x in )
>           result = "got it!";
>       case string:
>         result = "f() failed: " + x;
>       }

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

As one additional note, even with this added, we wouldn't otherwise
extend the operations that are allowed on "any" instances. Right now,
there's actually not much one can do with them, and it would stay that
way to avoid people starting to generally skip the typing system
(e.g., one cannot assign an "any" to another "any"; more generally,
one cannot pass them around arbitrarily). The "switch" is for using
"any" safely in cases where it cannot be avoided (which is primarily
bifs with return values that cannot be statically typed).


Robin Sommer * ICSI/LBNL * robin at icir.org * www.icir.org/robin

More information about the bro-dev mailing list