-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PoC: Support for standalone ASIO #102
Conversation
Very nice work! How standard is the practice of using "stdx" as a shim namespace? What would happen if a consumer of pion was also using a "stdx" namespace as a shim? Let's say MongoDB wanted to start using pion; would there be conflicts using this approach? |
@acmorrow @mikedickey Is it good to provide multiple commits within pull request or is it better to re-base multiple commits into single change? BTW, all Travis-CI builds are failed https://travis-ci.org/splunk/pion/builds/92982315 Perhaps it should be fixed before merge. |
@mikedickey - I don't think MongoDB is the only one to do this, but the choice of namespace stdx is of course arbitrary. We could always change it. As far as whether it will conflict, I don't think it should, since each is guarded under a different top level namespace. My biggest worry I guess would be some sort of crisis with argument dependent lookup. Or, maybe not. I guess the idea is that if you do this right, everyone agrees on what those types in 'stdx' mean. You could certainly get in trouble if you did both 'using namespace pion' and 'using namespace mongo' in the same TU, but then that is on you. I'll let you know in a couple weeks. I have something I want to prototype using this :) @snikulov - The multiple commits was more in the spirit of 'show your work'. They would need to be squashed before commit anyway, since there are actually some interdependencies between them that crept in as I iterated and rebased fixups in. In particular, the asio shim header depends on the functional shim header, but is sequenced before it in the commits. Regarding Travis: Yeah I made a silly mistake and forgot that 'using' style typedefs don't work in C++03 mode. All my builds used --std=c++11 by default I think, independently of whether I built in standalone mode. Oops. Anyway, I don't expect that it will be a huge issue to repair. I'll try to get that fixed up sometime soon. Overall, I'm not suggesting a merge for this anytime soon, hence PoC, but I wanted to get it out there for some early feedback before spending more time on it. I'll check back in a couple weeks and let you know how my experiment works out. |
@acmorrow personally I don't care about |
@mikedickey @snikulov I just pushed another commit to fixup the bad typedef. It should build now in C++03 mode. |
Oh, I didn't realize on first pass that "stdx" was actually "pion::stdx" not "::stdx"! ;-) |
@mikedickey FYI CLA signed. |
The standalone ASIO doesn't use the boost types, it uses the C++11 standard ones. This PR is a PoC of a mechanism to let PION either use the C++11 types and the standalone ASIO, or use boost for both ASIO and C++11-esque things.
It isn't 100% complete, as there are few more things that could be shimmed (regex, random), and a few things that would still need some thought (scoped_array and shared_array), since they don't have 1:1 analogues. I've also not even tried to run any tests - just getting it to build (also I coudn't figure out how to run the tests from a CMake build).
For the most part, the code changes are mechanically changing boost:: -> stdx:: and updating the headers. There are a few places where I had to make some smaller spot changes, but they are rare.
Please note that I tried to sign the CLA in case there is actual interest in merging this, but I was unable to do so per #101
Note that the technique used here is modeled heavily on the one used in MongoDB as it transitioned from C++03 to C++11:
https://github.com/mongodb/mongo/tree/master/src/mongo/stdx
Thanks,
Andrew