Live data from Hacker News

A library for effect handlers in C++

github.com

1–10 of 12 posts

Re: A library for effect handlers in C++

#5
post #2

Isn't this kind of thing supported natively with C++ coroutines as of C++20?

Kind of.

You still need a runtime library, which should be integrated by C++23, lets see.

What C++ has better than Rust on this regard is that C++20 at least shipped at the necessary vocabulary types and compiler magic, so the plug-and-play story across runtimes (HPX, C++/WinRT, kokos,....) is much more sound today.

Re: A library for effect handlers in C++

#6
post #2

Isn't this kind of thing supported natively with C++ coroutines as of C++20?

You mean threading? That is just one common example for what is possible with arbitrary effect handlers.

There is a CppCon talk where they use co-routines to deal with exceptions, Swift style.

Re: A library for effect handlers in C++

#10
post #2

Isn't this kind of thing supported natively with C++ coroutines as of C++20?

Only to a certain extent. The question is not only if something is possible, but also what the most convenient way to express it is. Effect handlers do have some interesting ideas for programmer-level interface, like user-defined typed commands and dynamic pairing of commands with handlers. In this sense, C++20 coroutines or Boost Context are lower-level, and maybe not the most convenient building blocks for implementing complicated concurrency scenarios, yet alone effects that do not look like concurrency at first sight, like exceptions or different forms of mutable state.
Post reply on HN