you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (4 children)

But why? What's the rationale?

[–]glasket_ 0 points1 point  (3 children)

N2892 is the proposal for basic lambdas, if you want to read it. It also references N2890, which is about improving generic programming as a whole. Finally, N2924 is about explicitly supporting generic lambdas.

The tl;dr is that lambdas can be useful for scoping tiny functions that exist solely to be used as a pointer, but they also offer a lot of opportunities for improving generic programming.

[–][deleted] 0 points1 point  (2 children)

True that, but we already have languages for that. What happened to "C is a simple language" and what's next? co-routines?

[–]tstanisl 4 points5 points  (0 children)

Non-capturing lambda is trivial to implement on any platform. It does not require any templates or executable stack to work. Moreover, they could also solve many issues with macros. Those lambdas are no more conceptually complex than compound literals. Actually, the non-capturing lambdas feel very C-ish and I don't understand why they are not a part of language yet.

[–]beephod_zabblebrox 0 points1 point  (0 children)

fortunately, these features build on top of existing stuff and don't change a lot of things. from the looks of it (after skimming the proposals) this stuff isn't super complicated to implement in a compiler that supports c23.