
C++ Stackless Coroutine - adamnemecek
https://github.com/jbandela/stackless_coroutine
======
educar
Post-C++ 11 code is so very different from pre-C++ 11. Things are so different
that I cannot even understand many of the constructs anymore. I realize C++11
is 5 years old now but still. I fear the same thing might happen to javascript
as well with the changes in es7. I don't think this is a good thing for
languages to change so much that the style becomes very different. This is
probably the reason why developers like Go. The language designers are
reluctant to change it from the get go.

~~~
CyberDildonics
C++11 is in a state right now where it is essentially unchallenged. It runs
natively, has no garbage collection, zero cost abstractions, automatic memory
management (memory leaks don't cross my mind any more) and most importantly, a
hugely mature ecosystem.

C++11 on up is nothing short of revolution in systems programming. Hopefully D
and Rust will be there eventually but right now no other language even comes
close to the maturity of having 4 compilers you could bet your business on and
just as many IDEs.

~~~
paulddraper
I think you're understating the case for Rust.

Rust has a better standard library (e.g., std::option) and better resource
abstractions.

The "existing code" advantage seems a weak case at best for C++, given that it
doesn't even have a package manager to use the code. Including 3rd party code
is nightmarish.

A greenfield project would have to think long and hard about taking on the
enormous bloat and not-for-mortals specifications of C++ over Rust.

~~~
adrianN
I also think that Rust has a bright future ahead, but C++ will probably live
forever. There is a huge amount legacy code in C++, a lot of it tied to
embedded systems that have service contracts that measure decades.

C++ didn't manage to displace C completely, I doubt that Rust will manage to
displace C++. This is especially true now that C++ is seeing active
improvement that makes it a lot more attractive for new projects.

~~~
pjmlp
While true, I think the rise of Linux and FOSS, alongside embedded development
helped C stay around.

On Mac OS, Windows, Symbian, BeOS, even commercial UNIX with CORBA and Motif
OO libraries, developers were already transitioning from C to C++ when Linux
and FOSS, which depend heavily on C, started to gain adoption.

Then you have the embedded space, specially with micro-controlers, where even
packing C into the EPROM is already an exercise.

As for C++, the new standards rely reinvigorated it, with Apple, Google and
Microsoft pushing it forward.

One of the reasons I updated to Windows 8 (now on W10) was to be able to use
C++/CX with XAML. Visual C++ finally catched up with C++ Builder in terms of
RAD experience.

This where I see Rust still needs to grow. There are lots of use cases where
Rust still does not provide an out-of-the-box solution vs C++ tooling does.

------
halayli
Shameless plug:

[http://lthread-cpp.readthedocs.io/en/latest/lthread.html](http://lthread-
cpp.readthedocs.io/en/latest/lthread.html)

------
xchip
could this be easily done without using boost?

~~~
jbandela1
Author here. The library itself (stackless_coroutine.hpp) has no dependencies
other than C++14, and you can easily use it in any C++14 project with any
async library.

For writing an interesting example, I wanted to do an example of how the
library can simplify async network code. A widely used async C++ library is
Boost.Asio, so that is what I used for the example.

TLDR: The library itself has no dependency on Boost. Boost.Asio was just used
for the example.

~~~
funkaster
It's a good example. I'm really liking asio so far. However, I've been using
the standalone version[1]. Maybe you could do the same with your library?

[1]: [http://think-async.com/Asio/AsioStandalone](http://think-
async.com/Asio/AsioStandalone)

~~~
jbandela1
I am planning on overhauling the example to use that latest version of Asio
standalone that is tracking the C++ Networking TS. That way it will be a
simple matter of people changing asio to std::experimental::net on a compiler
that implements the Networking TS.

------
ambrop7
Does this really "help" in anyone's design? I know some people despise
callbacks, but I would much rather read callback-based code than this (looking
at example.cpp).

