[Bro-Dev] set and vector operators
Vern Paxson
vern at corelight.com
Fri Jun 15 17:33:38 PDT 2018
1.5 months ago we haggled over adding these and came close to converging,
and then I dropped the ball on trying to ice the deal :-(. (Well, I also
needed some time to lick my wounds, since I didn't get my way much on
syntax preferences! :-P)
Here's where I believe we wound up:
(1) Add bitwise operators on "count" variables for &, | and ~.
(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.)
(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.
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.
Again, my apologies for the lengthy lull in attending to this thread.
Vern
More information about the bro-dev
mailing list