[Zeek-Dev] support for event handlers using a subset of parameters

Jon Siwek jsiwek at corelight.com
Fri Feb 1 09:17:09 PST 2019


On Fri, Feb 1, 2019 at 10:24 AM Robin Sommer <robin at corelight.com> wrote:

> On Thu, Jan 31, 2019 at 16:29 -0800, Vern Paxson wrote:
>
> > >     global my_event: event(a: count, b: string);
> > >     event my_event(b: string)
> > >         { print "my_event", b; }
>
> it *looks* like an error to not have matching
> argument lists. Is there some syntax that would make it more clear
> what's going on?

Not sure.  If the syntax were different, that introduces a "one more
thing to remember" issue, so I might prefer consistency with other
function-like constructs.

Any other language we know that has multi-body functions we can
reference for ideas?

Did it look like an error in the sense of the user making a mistake or
in the sense of traditional way functions in other languages like
C/C++ require matching signatures?

In the former, I think the semantics/intentions are actually clearer
than before: the user didn't list a parameter because they don't care
about it, so why make them.  I know what event they want because they
use unique names and the parameters they listed do map in a valid way.

On the traditional side of things, overloading seems it's maybe a
legit reason for requiring matching signatures, but I also explained
why I think overloading wouldn't make sense in the context of events.

- Jon


More information about the zeek-dev mailing list