Apple Blocks added to C++?

Walter Bright newshound1 at digitalmars.com
Wed Sep 2 00:31:43 PDT 2009


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.



More information about the Digitalmars-d mailing list