[Bro-Dev] [Proposal] Language extensions for better Broker support
vallentin at icir.org
Mon Jan 2 12:00:36 PST 2017
On Wed, Dec 14, 2016 at 04:17:26PM +0000, Siwek, Jon wrote:
> > On Dec 13, 2016, at 11:42 AM, Matthias Vallentin <vallentin at icir.org> wrote:
> >>> local r = put(store, key, test(lookup(store, key)));
> > It's up to the user to check the result variable (here: r) and decide
> > what to do: abort, retry, continue, or report an error.
> The thing that got me about that for this particular example was that
> I can’t distinguish whether the "lookup" or the “put” failed, which
> might be important since the “test” operation is between them and I
> may or may not want “test" to happen in the retry attempt depending on
> what exactly failed.
Yes, in this case that's not possible. Though nothing speaks against
tearing the expression apart if you need to that distinction. It might
not have been the best example, but I wanted to illustrate the semantics
of composition of asynchronous functions.
Overall, Bro is an asynchronous language with imperative building
blocks. Especially with this inherent (and now increasing) asynchrony,
I think it's important to look at established concepts from functional
paradigms that demonstrate the utility of composable primitives.
More information about the bro-dev