upvote
Kinda disagree here about the "elegantness", superficially it's an elegant abstraction to unify generator-like coroutines and "tasks".

In practice it's bad, a generator (co_yield) is often an encapsulated object that will have a non-deterministic lifetime, thus it cannot be put into a fifo.

"Tasks" however (co_await / co_return) often live on a stack-fifo that could've been mixed with partial bump-allocators to allow pointer-stability for the stack-frame (there is kind of the machinery via the new overloading for the promise), but due to varying lifetimes it easily becomes a mess (Looked at some other task library that seemingly had low allocations like this but it feels like the entire machinery can easily break with "careless" usage).

And I think that's a part of why std::execution feels like a mess, it tries to make coroutines in task settings more "usable" for those writing things around tasks, but it doesn't really decide on a coherent direction for tasks (since the language primitive was left too abstract/messy).

reply
Well LLVM supports HALO optimization can remove frame allocations when the coroutine lifetimes are suitably nested, though you need to apply some specific annotations to assert this is safe in a given context before it will kick in.

> there is kind of the machinery via the new overloading for the promise

Any details?

reply
I'm not too familiar with generators. I've never really had much use for them. I've used co_yield once successfully to interleave two separate tree recursions in lock-step and I don't remember any issues.

It's also not at clear to me why you'd want to put a generator into a fifo. Any succinct code snippets that demonstrate the issue?

reply
I think you touched on the main issue but blew past it. There isn't a simple, universal package manager solution.

You can have all the standardization in the world but if you can't trivially swap one implementation for another then what's the point?

I also feel this is self fulfilling. If there's no simple way to pull in libraries then why worry about being compatible anyway? Every codebase has its own quirks and build setup and macros. Why not? There was no simple tool they broke by making those choices.

reply
If you can swap out the implementation then that means you can't mess with the API.

I feel like this is really a commentary on how young rust is as a language that this issue hasn't been important yet. It takes a long time to realize an API is a mistake.

Note that I said API not ABI above. ABI is a different category of problem.

reply
> C has most of the same problems raised in the article

Correct but I'd argue almost nobody builds desktop applications in C anymore and the places where C is the most common (embedded) they built full on frameworks including package managers around them.

reply
The one I know about has stuck around for 30 years, no one has been able to replace it. Many have tried, all failed. It’s just too big to fail.
reply
I don't disagree that C is here to stay, I'm saying that C is in a different position than C++ where its shortcomings don't matter as much.

If you write any daemon that uses jsonrpc for example you immediately pull in 100k+ loc of dependencies just to get off the ground (json via nlohmann, a webserver, ser/de library possible etc) while for an embedded application a lot of projects itself are smaller than just the dependencies most C++ projects desktop have.

C++ competes with Rust. C doesn't.

reply
I think C and C++ always have suffered from wanting to support all kinds of weird architectures like 9 bit bytes and 80286 style segmented memory. So many people see this as a virtue rather than restricting the usefulness of C.

So char always means "byte" and never a real character. I don't think many C programs will work well if char is a 32 bit type so it supports full unicode.

int8_t came way too late and has a way too long name. It should be i8 or int8. There is a problem when C is more verbose than Java. Also: why did it take so long to get a boolean type and fix the "bools are ints" design mistake.

Lack of standard libraries and module system is just another layer of not wanting to standardize things.

reply
>I don't think many C programs will work well if char is a 32 bit type so it supports full unicode.

That's not really how unicode support works. It can be useful to have a specific type for storing unicode code points (like Go's 'rune' type), but strings are generally UTF-8 encoded these days, so having a wide char type plays at most a marginal role in a language's unicode support.

reply
C shouldn’t suffer from these problems. It is just not a language to write massive projects with a ton of complex dependencies in.

C will make this obvious by stepping on your toes. C++ will help you along until it has enough leverage to break ‘em.

reply
We have developed coroutine-native networking for C++20, and designed it to become a de-facto standard. It has no external dependencies. It does not require Boost. https://corosio.org
reply
> There's no universal package manager for C. No standard library worth a damn.

The package manager for C is whatever your distribution uses plus pkg-config. The standard library is the C standard stuff plus POSIX.

reply