3 ms·
No, I never wanted to write C that way. That looks too much like C++, with its std::for_each and things that look potentially useful, until you actually try fin
by mtdewcmu 14y ago
No, I never wanted to write C that way. That looks too much like C++, with its std::for_each and things that look potentially useful, until you actually try finding a use for them.
What I have wanted is closures that you can stick data inside. But they can't be done in a reasonable way in a language like C. The C++ version falls short of usefulness.
- cioc 14y agoIs that a challenge?
- mtdewcmu 14y agoClosures? It would most likely be a frustrating and unrewarding one, but sure. One thing I would like in C is a more programmable preprocessor. C++ templates are on to something useful -- metaprogramming removes some of the drudgery from writing fast native code. Templates are fatally flawed, though. I think it may be possible to get some of the benefits from a smarter preprocessor -- if it was done conservatively in the C style.
- darkf 14y agoThe Blocks extension for C provides you with anonymous closures, if you wish.
- pohl 14y agohttp://lambda-the-ultimate.org/node/3593 http://lambda-the-ultimate.org/node/3593
- pohl 14y agoI should have shared this link instead... http://en.wikipedia.org/wiki/Blocks_(C_language_extension) http://en.wikipedia.org/wiki/Blocks_(C_language_extension)