[Bro-Dev] more set operators? (equality/subset)

Johanna Amann johanna at icir.org
Fri Jun 29 08:52:01 PDT 2018

On Sun, Jun 24, 2018 at 07:07:06PM -0700, Vern Paxson wrote:
> 	s1 == s2  iff  both sets have exactly the same members
> 	s1 < s2   iff  every element in s1 is in s2, but s2 has some
> 		       elements not in s1


> Any concerns with adding these too?

I actually have a small question when thinking about these - which I
should already have raised about the intersect operators. What happens
when sets contain records or other complex types in these cases?

>From what I can tell, Bro so far refuses to compare records - the reason
being that (I think) we do not have properly implemented comparison
operators internally. For example, the following script:

type A: record {
	a: string;

event bro_init()
	local i = A($a="a");
	local j = A($a="a");
	print i == j;


$ bro test.bro
error in ./test.bro, line 9: illegal comparison (i == j)

I assume what will at the moment happen with sets is that the pointers of
records are checked for equality - not the content. Which might arguably
be a bit non-intuitive.

As I said this is more of a concern about the already added operators - in
principle I don't have a problem with ==, but I think it should work for
other complex datatypes too.


More information about the bro-dev mailing list