I am still trying to figure out why Pascal had nested procedure/function definitions. It was pretty weird to define a function only visible inside the current function/procedure, that you are only going to call one time, in most cases, during the run of the outer procedure/function. Some kind of Lambda expression would probably have made more sense.
...
-MilesAhead
Not a problem here, though I consider myself a Pascal tinkerer. Pascal isn't the only culprit either; Lisp, Javascript, Actionscript, Wolfram, D, MATLAB... even the 'Big Four' scripting languages (Python, Ruby, PHP, Perl) more or less. Yes, things like this can be abused, like nesting to ridiculous levels (which is almost never done unless you're masochistic), or the
Funarg problemw, which isn't the end of the world. There are advantages of nesting as well, like avoiding global variables or namespace pollution. See
Nested_functionw, and this post:
Re: Nesting functions- Why?.
Either way, nested functions in an object-oriented language aren't really needed, and most modern dialects of Pascal (Delphi, Freepascal, GNUPascal) have object capabilities built-in, so the point is a little more moot now.