Walter Bright wrote:
Tim M wrote:
Walter: may I ask with this, reddit posts and dobb's code post, why
the interest in this particular topic right now? Didn't you implement
this a long time ago?
It was one of the first things implemented in D.
But I was thinking about it lately as I prepare the materials for the
Compiler Construction seminar in a few weeks. Everyone tells me they are
simple and obvious, yet in language after language they get added in
bizarre ways that suggest that *somebody*, me or them, is just not
getting it.
So I thought it was time for an article.
I mean, how can one miss the most stunningly obvious syntax:
int foo(int a)
{
int bar(int i) { return a + 3; }
return bar(3);
}
and that nested functions are useful for many more things than passing
around pointers to them. For example, as helper functions.
It has been a GCC extension for a long time:
http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC65