[Bro-Dev] Closures in Bro
Jan Grashöfer
jan.grashoefer at gmail.com
Tue Dec 19 07:54:37 PST 2017
Hi everyone,
playing around with the add-json package, I realized that I will need to
"extend" functions like the path_func at some point. That is, I need to
calculate a value using the original version of the function and "add"
my calculations on top. My approach is to wrap the function, which works
as long as I don't need "multiple versions" of that function. In the
latter case closures would help, e.g.:
function do_add(i: int): function(j: int): int
{
return function(j: int): int {return i+j; };
}
However, referencing outer function IDs is not supported (see
http://try.bro.org/#/trybro/saved/196147).
In the light of the flexibility that comes with packages, I think
supporting closures would be a nice feature. Was there any fundamental
design decision against supporting closures?
Jan
More information about the bro-dev
mailing list