r/cpp • • Oct 24 '24 • Take My Silver 1

Why Safety Profiles Failed

https://www.circle-lang.org/draft-profiles.html
180 Upvotes

347 comments sorted by

View all comments

Show parent comment

5

u/Dalzhim C++Montréal UG Organizer Oct 26 '24

Uh, you can call regular functions from coroutines, you can call non const functions in const functions much of the time.

It's the coloring problem. A boost::asio::awaitable<T> can co_await other boost:asio::awaitable<T> coroutines, but it can't co_await unrelated coroutines. As for const, I'm guessing you meant that non-const can call into const rather than the other way around. It's viral in the sense that once you have a const function, you can only call other const functions unless you use the escape hatch: const_cast to cast away const.

The thing is: statically expressing a transitive property that requires local reasoning is bound to be viral to a certain degree.