[Bro-Dev] set and vector operators

Jon Siwek jsiwek at corelight.com
Thu Jun 21 12:12:28 PDT 2018


On Fri, Jun 15, 2018 at 7:40 PM Vern Paxson <vern at corelight.com> wrote:

> (1) Add bitwise operators on "count" variables for &, | and ~.

Yeah, looks like everyone was in favor of those.

> (2) Deprecate element-wise arithmetic operations on vectors, such
>     as "v * 3" meaning "multiply each element of v by 3".  Perhaps down
>     the road we'll introduce syntax that flags things like "for this
>     expression, vectorize it".
>
> (3) Implement "v += e" to mean "append the element e to the vector v".
>
> (4) Wait on whether "v + e" should mean "return a vector that is v with
>     the element e appended".  (And indeed we can't do this right now if
>     we're #2.)

This sounds like what everyone was thinking.  My suggestion for the
timing of these would be to implement the deprecation (2) by itself
ASAP, at least before the 2.6 release, and shortly after 2.6 it can be
removed in git/master and both (3) and (4) done.  Hopefully 2.6 is not
terribly far away.

> (5) Keep "add" and "delete" for manipulating sets in terms of individual
>     elements.
>
> (6) Add "s1 & s2", "s1 | s2", and "s1 - s2" as intersection, union,
>     and set difference.

Yeah, sounds right.

> I'm not clear whether we reached agreement on:
>
> (7?) Add "s1 &= s2" etc. to mean "s1 = s1 & s2".  The advantage of
>      having this as an operator is it might more easily enable efficient
>      implementation of some set operations for big sets.  I suppose
>      if we have it then we'd be expected to also have:
>         (7') "c1 &= c2" etc., i.e., bitwise assignments for "count"
>              variables.
>
> Please chime in if you remember where we wound up differently, and also
> whether you disagree with #7.

I don't see much previous discussion around these, though they all
make sense to me.

- Jon


More information about the bro-dev mailing list