[Bro-Dev] Hooks (Re: [Bro-Commits] [git/bro] topic/jsiwek/hook: Add new function flavor called a "hook". (e0fb9eb))

Siwek, Jonathan Luke jsiwek at illinois.edu
Tue Nov 20 08:33:59 PST 2012

> I haven't looked too closely yet but I want to mention one thing Seth
> and I discussed earlier this week: we could give hooks a mandatory
> boolean return value and use that instead of the "break" command:
> "return T" would continue with the next hook, and "return F" stops. In
> addition, the hook statement becomes an expression that returns the
> boolean (i.e., T if all ran through, and F is one stopped execution).
> Thinking now about it, I believe either way is fine. The boolean hook
> would convey a bit more information back to the caller and allow
> simple yes/no decisions that way. But I'm not sure we need that. On
> the other hand, Seth didn't like the "break" so that would go away.
> Wanted to put that up for discussion, not leaning strnonly either way
> right now.

I don't have a strong opinion, either, but I'm leaning toward allowing a boolean return value since it's the more flexible and most similar/familiar to how functions work.

But I do think if it had a return value, then it shouldn't mix in "break" to allow implicitly returning values, but require "return" like normal.

If you want, you can hold off on merge until this is decided, it's probably not just a trivial change to do (but not likely too difficult either).


More information about the bro-dev mailing list