celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [celix] pnoltes commented on issue #203: Feature/osgi promise
Date Wed, 22 Apr 2020 06:53:39 GMT

pnoltes commented on issue #203:
URL: https://github.com/apache/celix/pull/203#issuecomment-617587629


   > > > Also, I'd prefer if this library would be separate from celix, so that it
is usable without adding celix to your project.
   > > 
   > > 
   > > Same setup as etcdlib?
   > 
   > I was actually thinking of a separate repository, which I had expected for etcdlib
as well. However, perhaps that's something for a future date.
   > 
   > > > What is the reason to focus on std::function instead of template args?
   > > 
   > > 
   > > I personally find the API much clearer without template arg if they can be avoided,
so that why I prefer the use of std::function. What is the benefit of using template args?
   > 
   > Depending on situation, there is a sizeable performance impact on using std::function.
See https://stackoverflow.com/a/14678298 for a proper explanation and especially a [comment](https://stackoverflow.com/a/15045156)
further down explaining that it depends on compiler as well.
   > 
   > What I do think though, and why I think libraries such as [continuable](https://github.com/Naios/continuable)
are in C++14, is that C++11 doesn't support some template niceties that may make implementing
template lambdas difficult for celix.
   
   Ok, good info.
   Note that eventually all callbacks are stored as std::function<void()> in the SharedPromiseState.
   With the current setup this cannot be template, because callbacks with different signatures
(e.g.a success, failure, thenAccept, etc callbacks) are simplified as std::function<void()>
and stored.
   
   That being said, the Promise API can be updated to accept template args. For this PR I
will add this as remark to the readme. A future update will then address this. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message