Re: [Bro-Dev] functions truly as globals?

2013-09-30 Thread Siwek, Jonathan Luke
 I think that in addition to changing those to const we'd change Bro to not 
 accept creating global functions.

You still effectively have global functions if you have a global record w/ a 
field that is of function type.  Do we do something about that?

 Are there other inconsistencies?

I think more limitations and the current implicit const are adding 
inconsistency and complexity (which comes with more opportunities to bypass in 
unintended ways).

So I'm trying to understand how immutable do function values have to be.

The actions I think increase consistency are:

1) change most/all global function decls in scripts shipped w/ Bro to 
explicitly use const
2) remove the implicit const from global functions

These should both be easy tasks, but are they actually enough to allow desired 
optimizations in the compiled-context?  What I didn't get from Robin's comment 
was if the problem is in what the language *allows* regarding function 
mutability or in the common *usage* of functions in current scripts?

- Jon
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


Re: [Bro-Dev] functions truly as globals?

2013-09-27 Thread Siwek, Jonathan Luke
  some_func = my_func;
 
 Please, no ... That's not only hurting readability profoundly but also
 prevents function-level code optimization. Just imagine the impact
 once we start compiling scripts ...

Doesn't readability improve if it makes functions behave in a way more 
consistent w/ other data types?  E.g. if you don't want a value to change at 
run-time, use the const modifier, but if you do, use local or global 
depending on what scope is appropriate (though actually using the later with 
that intention isn't recommended or whatever we want to do/say about it).

Right now, the rules for whether you can assign to a variable of function type 
at run time are a bit dicey.  I think you can always assign a function value if 
it's local.  And you can actually assign to a global only if it doesn't 
already have a value (a function body/definition).  Most people probably don't 
encounter these, but I do think it is jarring.

Changing most/all existing global function declarations to use const 
instead would help some, but what about the other inconsistencies?

- Jon
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


Re: [Bro-Dev] functions truly as globals?

2013-09-27 Thread Seth Hall

On Sep 27, 2013, at 4:28 PM, Siwek, Jonathan Luke jsi...@illinois.edu wrote:

 Changing most/all existing global function declarations to use const 
 instead would help some, but what about the other inconsistencies?


I think that in addition to changing those to const we'd change Bro to not 
accept creating global functions.

Are there other inconsistencies?

  .Seth

--
Seth Hall
International Computer Science Institute
(Bro) because everyone has a network
http://www.bro.org/



signature.asc
Description: Message signed with OpenPGP using GPGMail
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


Re: [Bro-Dev] functions truly as globals?

2013-09-26 Thread Robin Sommer


On Thu, Sep 26, 2013 at 16:06 -0400, you wrote:

   some_func = my_func;

Please, no ... That's not only hurting readability profoundly but also
prevents function-level code optimization. Just imagine the impact
once we start compiling scripts ...

Robin

-- 
Robin Sommer * Phone +1 (510) 722-6541 * ro...@icir.org
ICSI/LBNL* Fax   +1 (510) 666-2956 * www.icir.org/robin
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev


Re: [Bro-Dev] functions truly as globals?

2013-09-26 Thread Seth Hall

On Sep 26, 2013, at 6:34 PM, Robin Sommer ro...@icir.org wrote:

 Please, no ... That's not only hurting readability profoundly but also
 prevents function-level code optimization. Just imagine the impact
 once we start compiling scripts ...


Cool, I agree.  I just had to make sure. :)

  .Seth

--
Seth Hall
International Computer Science Institute
(Bro) because everyone has a network
http://www.bro.org/



signature.asc
Description: Message signed with OpenPGP using GPGMail
___
bro-dev mailing list
bro-dev@bro.org
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev