On Fri, Dec 16, 2016 at 01:36 -0500, you wrote:
> I don't know. It just feels too magic otherwise, To me, "v == Error::XYZ" would feel ok still, yet "v == Broker::XYZ" is getting borderline (because the latter means there's no clear single concept here (error checking), it could mean whatever the value type wants). Maybe we need something else altogether. We could add a BIF that takes the role of the cast, but gives more context what happens: local v = Broker::lookup(h, 42) if ( status(v) == Broker::SUCCESS ) print (v as string); That could be a Broker-specific BIF (then probably Broker::status()) or a generic oben working with opaques in general. We could also make the two different return values explicit: [result, value] = Broker::lookup(h, 42) # Returns [Broker::Result, opaque of Broker::Data] if ( result == Broker::SUCCESS ) ... This would be new syntax, as we don't have tuples yet to implement this directly. But for-loops already support something not too different for iterating over multi-value indices. We could also bite the bullet and add full tuples to the language (but that's quite a bit of work). Another downside is that "result", and "value" would need to be declared first, making it less concise. Robin -- Robin Sommer * ICSI/LBNL * ro...@icir.org * www.icir.org/robin _______________________________________________ bro-dev mailing list bro-dev@bro.org http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev