Hacker News new | ask | show | jobs
by withoutboats 2838 days ago
It's C. I assume the programmer would just be responsible for dealing with dangling pointers and double frees.
1 comments

... and there's ample evidence that this is a reasonable assumption, so let's do closures based on it, too! :)
> ... and there's ample evidence that this is a reasonable assumption

Actually, there is. C might be a colossal footgun but reasonably experienced developers do manage to avoid those problems.

I'd like to see that ample evidence. On the contrary, I know even fairly experienced developers who get burned with memory issues in C - and I have never ever heard of even the most junior developer to have any problem with double frees in Java :)

Plus..... even if you could do that, WHY? C is a simple language, close to the "metal". If you want a language that has every-feature-and-their-mother, and can be close to the metal when needed, and can be used to blow both your feet off, just use C++.

Adding functional closures to C is somewhat akin to adding "asm" and "volatile" in Haskell.... even if you could do it, why would you? It just breaks the very essence of the language.

Well, that's what C++ lambdas do. Though C++ has smart pointers to help with lifetime issues.