45 ms·
Look at Apple's blocks (LLVM/Darwin and FreeBSD only, I believe), GCC's anonymous or nested functions (may be supported by LLVM too, they tend to copy GCC langu
by JoachimSchipper 15y ago
Look at Apple's blocks (LLVM/Darwin and FreeBSD only, I believe), GCC's anonymous or nested functions (may be supported by LLVM too, they tend to copy GCC language extensions), and (a very restricted subset of) C++.
Also note that C is easy to parse. It's definitely possible to write a C-to-C compiler that supports parts of Apple's syntax (e.g. "oneFrom = ^(int anInt) { return anInt - 1; };"), just by replacing every ^ by a function pointer to a function defined at the end of the current file.
Of course, blocks is much more than that (e.g. includes memory management), and there is a reason for that...