Remix.run Logo
▲ torginus 40 minutes ago

Each to their own I guess, by personally I really don't like closures (at least ones that as per their namesake, close over objects with nontrivial lifetimes).

I think it was the right call by the C++ people to explicitly list what objects are captured and how, even if the syntax's not the best.

RAII is a fact of life unfortunately, not just in C++ or Rust, but if you talk over some high level protocol over the internet you go TCP socket->HTTP connection->your stream protocol; and have to do the exact reverse.

Closures break RAII hard.

Incidentally, you don't even need closures for nice looking UI code. Immediate mode GUIs like Dear Imgui or Clay allow for super-simple looking code in basic C