4 ms·
It's C. I assume the programmer would just be responsible for dealing with dangling pointers and double frees.
by withoutboats 8y ago
It's C. I assume the programmer would just be responsible for dealing with dangling pointers and double frees.
- virgilp 8y ago... and there's ample evidence that this is a reasonable assumption, so let's do closures based on it, too! :)
- bonzini 8y agoWell, that's what C++ lambdas do. Though C++ has smart pointers to help with lifetime issues.
- geezerjay 8y ago> ... 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.
- virgilp 8y agoI'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.