[Bro-Dev] functions truly as globals?

Seth Hall seth at icir.org
Thu Sep 26 13:06:25 PDT 2013

At scriptland, when we define function prototypes we define them as globals but they seem to be turned into consts in the core.  Does it make sense to actually make them globals?

It would allow me to do runtime monkey patching… which I'm not saying I'd ever do (wink, wink).  But it would make runtime instrumentation and measurement significantly easier for some things.  Here's an example of what I'd like to be able to do…

global some_func: function(): string;

function some_func(): string
	return "Original function";

function my_func(): string
	return "monkey patched!";

event bro_init()
	some_func = my_func;

Hopefully this would print "monkey patched!".

Are there any conceptually any major problems with doing this?  We should still be able to do parse time typing correctly in this case too I believe.


Seth Hall
International Computer Science Institute
(Bro) because everyone has a network

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://mailman.icsi.berkeley.edu/pipermail/bro-dev/attachments/20130926/7c3ae613/attachment.bin 

More information about the bro-dev mailing list