[Bro-Dev] [Proposal] Language extensions for better Broker support
Seth Hall
seth at icir.org
Thu Dec 15 09:04:40 PST 2016
> On Dec 14, 2016, at 10:27 AM, Robin Sommer <robin at icir.org> wrote:
>
> local v = Broker::lookup(h, 42) # Continues to return 'opaque of Broker::Data'
>
> if ( v == Error::Success )
> print (v as string);
This is a neat trick and would be nice if all Bro types could be compared against error enums.
> Seth, a question: do you have more in mind by "nicely generalized
> error handling" than this? Do you see a way to generalize this to
> purely script-level logic (i.e., no opaques, just normal Bro types
> being passed around)?
I don't have any concrete suggestions beyond or alternate to the one you suggested above. I actually really like the look but I think I need to try writing some code like that to see if I find issues with it. One thing I see immediately is that it seems like we're want to force people to cast the value to an error type, maybe like this...
if ( v as error == Error::Success )
I find "Error::Success" really unintuitive and kind of funny too. :)
.Seth
--
Seth Hall
International Computer Science Institute
(Bro) because everyone has a network
http://www.bro.org/
More information about the bro-dev
mailing list