logoalt Hacker News

kazinatoryesterday at 5:19 PM2 repliesview on HN

Defininig a callback interface in C without a user context parameter is a capital crime.


Replies

eqvinoxyesterday at 11:34 PM

Honestly all I would want from C closures is a better syntax for doing exactly that. Whatever it ends up being (if it goes in), it better have some way to interop with "legacy" function pointer + user context APIs. (Including some way to tell the compiler where the user context pointer goes on the closure's arguments.) Otherwise it's just completely useless.

CerryuDuyesterday at 6:52 PM

That's all there is to it. I don't understand the whole obsession with closures.

I've used lambdas extensively in modern C++. I hate them with a passion.

I've also used OCaml. An awesome language where this stuff is super natural and beautiful.

I don't understand why people want to shoehorn functional programming into C. C++ was terrible already, and is now worse for it.

> we’re going to be focusing on and looking specifically at Closures in C and C++, since this is going to be about trying to work with and – eventually – standardize something for ISO C that works for everyone.

Sigh. My heart sinks.

show 1 reply