[Bro-Dev] #972: Default arguments for functions

Bro Tracker bro at tracker.bro.org
Fri May 3 15:57:08 PDT 2013

#972: Default arguments for functions
  Reporter:  robin            |      Owner:
      Type:  Feature Request  |     Status:  new
  Priority:  Low              |  Milestone:  Bro2.2
 Component:  Bro              |    Version:  git/master
Resolution:                   |   Keywords:

Comment (by seth):

 > global foo: function(a: string &default="hello");

 Oooh, you used an existing idiom even!  Nice job.

 > # TODO: adding &default should be optional on impl if decl has it?
 > function foo(a: string &default="hello")

 Yikes, I have no clue on this.  I'm inclined to say that it should be ok
 for it to be optional.

 > # TODO: should be a parse error?
 > # (i.e. follow C++ rules that default params must be rightmost ones)
 > function baz(a: string &default="err", b: string)

 Yes, definitely should be a parse error.

 Do these defaults work with events and hooks too?  I have no clue if I'd
 ever want to use defaults for those, but it seems like it should to keep
 things consistent.  Although for events it could be a bit weird because
 the default value would have to be applied by the calling process so that
 the default value is serialized and sent to the remote process as-is.  No

Ticket URL: <http://tracker.bro.org/bro/ticket/972#comment:1>
Bro Tracker <http://tracker.bro.org/bro>
Bro Issue Tracker

More information about the bro-dev mailing list