On Thu, 2016-03-24 at 14:23 -0400, Andrew Stitcher wrote:
> Adding list as well:
> 
> On Thu, 2016-03-24 at 13:59 -0400, Alan Conway wrote:
> > 
> > ...
> > Disagree. Example:
> >  
> > connection c = ...;
> > sender s = c.open_sender(...);
> > message m = ...;
> >  
> > c.inject([s, m]() { s.send(m); }); // Capture
> > c.inject(std::bind(sender::send, s, m)); // Bind
> Except this isn't using my proposed API!
> 
> that would be:
> 
> sender s = ...
> message m = ...
> 
> s.inject([m](s) { s.send(m); }); // A little different,
> // But no useless argument
> s.inject(std::bind(sender::send, _1, m)); // Very slightly different:
> // and perhaps a little harder to understand at first.
> 
> At least that is how I'd expect my proposal to work.

So for the user, your proposal is identical or "perhaps a little harder
to understand at first" compared to mine. What's the benefit? 

The disadvantage is it requires a different inject() signature on every
endpoint. I would argue that is more complicated for the user, but it
also creates an implementation problem for delegating to "real" event
loop. Instead of simply passing a `const std::function(void())&` up the
line, you must convert it from std::function(void(link)) to
std::function(void(connection)) to std::function(void(container)). Each
step creates a new and different std::function object, and each may
require a heap allocation.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to