Let me start by saying that I have an actual use case for this in the measurement framework and I'm not just messing around. :)
function add_x(x: count): function(a: count): count { local tmp = function(a: count): count { # The 'x' variable ends up receiving the value of the same arity as my inner # defined function instead of the value of the outer scope where 'x' is. return a+x; }; return tmp; } event bro_init() { local my_adder = add_x(5); print my_adder(1); # hopefully would print 6, but it prints 2 local your_adder = add_x(100); print your_adder(2); # hopefully would print 102, but it prints 4 } Would this functionality working like I wish it did be difficult? It would make a very nice usability feature for the measurement framework when setting thresholds. .Seth -- Seth Hall International Computer Science Institute (Bro) because everyone has a network http://www.bro.org/
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ bro-dev mailing list bro-dev@bro.org http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev