How Nested Functions Work, part 1
language_fan
foo at bar.com.invalid
Mon Aug 31 11:05:56 PDT 2009
Mon, 31 Aug 2009 10:37:29 -0700, Walter Bright thusly wrote:
> language_fan wrote:
>> This seems more like an advertisement of D than practical new
>> information for compiler construction. Nesting functions is the basic
>> feature of functional languages. Moreover even procedural Algol based
>> languages such as Pascal have always supported them, too.
>
> But not C, C++, Java, etc., so quite a lot of programmers have little
> experience with them, and even less understanding.
Most programmers I know don't use those languages, but then again I'm
part of some minority.
>
>> This information is also
>> taught in basic university level compiler courses.
>
> I bet only a tiny fraction of programmers have taken university compiler
> classes. (Also, they were not covered in compiler classes I took.)
> Consider also that the Java JVM doesn't support static links, and last I
> heard the .NET IL didn't, either.
Ok. We were taught that. We basically built a naive Pascal compiler.
>
>> Now that I checked what wikipedia had to say to the matter, it also
>> seemed to mention D. Apparently 'c-like syntax' plus 'advanced feature
>> <foo>' always equals 'innovation'.
>
>
> Nested functions aren't innovative; they just are apparently lacking in
> many other popular languages, and seem to confuse a lot of people. If
> you google it, you'll find there's a lot of programmer confusion about
> them. Hence an article as to how they work is in order.
For what it's worth, they also seem somewhat buggy in D. Hopefully
writing the articles motivates fixing those issues :) For example one
can't call symbols before their declaration on non-global scope.
>
> In part 2, I'll cover innovative things D does with nested functions.
Ok.
More information about the Digitalmars-d
mailing list