[Bro-Dev] syntax consistency question

Gregor Maier gregor at icir.org
Thu Mar 24 19:10:32 PDT 2011


Yeah, I also discovered that vectors are kinda limited in their
functionality. I think it would be great to have two different data
types in Bro. Possibly both supporting the same.

* array or vector (pretty much like the current vector type):
  + O(1) random element access
  + O(1) (armotized) adding to / removing from *end*
  + O(n) adding to / removing from *beginning*
  + grows (shrinks?) dynamically.

* queue, deque (for FIFOs, stacks, etc)
  + O(n) random element access
  + O(1) adding/removing from *either end*


cu
Gregor

On 3/22/11 19:26 , Seth Hall wrote:
> set[string]
> and
> vector of string
> 
> Why do these have such differing syntaxes?  I understand that internally vectors are really much more similar to tables than sets, but in usage they're more equivalent to an ordered set than a table (in my mind at least).  If we add FIFO-type operations to vectors so that they're easier to work with, they would feel even more like ordered sets.  For example, using a totally made up code snippet...
> 
> global stuff: vector[string] = vector();
> enqueue stuff["foo"];
> enqueue stuff["bar"];
> print |stuff|;
>   ==> 2
> print dequeue stuff;
>   ==> foo
> print dequeue stuff;
>   ==> bar
> print |stuff|;
>   ==> 0
> 
> Although it's essentially used as a FIFO here, it's still feels sort of set-y.  BTW, this code or something like it working would be awesome. :)
> 
>   .Seth
> 
> --
> Seth Hall
> International Computer Science Institute
> (Bro) because everyone has a network
> http://www.bro-ids.org/
> 
> 
> _______________________________________________
> bro-dev mailing list
> bro-dev at bro-ids.org
> http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev
> 


-- 
Gregor Maier
<gregor at icir.org>  <gregor at icsi.berkeley.edu>
Int. Computer Science Institute (ICSI)
1947 Center St., Ste. 600
Berkeley, CA 94704, USA
http://www.icir.org/gregor/


More information about the bro-dev mailing list