static and protection
David Medlock
noone at nowhere.com
Fri Mar 3 11:32:40 PST 2006
Don Clugston wrote:
<snip>
> On a tangentially related topic:
> Something I'm finding very interesting about D is inner functions.
> I'm finding that lots of things I would have used private class members
> for, I'm now using nested functions instead, with the result that simple
> classes sometimes disappear completely.
>
> With nested functions, you get extremely strong cohesion -- better than
> is possible in OOP. eg, generally, private class functions aren't
> completely private in OO languages. They appear in vtables, for example.
>
> I don't think this programming paradigm has been very well explored yet.
>
I absolutely agree. Inner functions are definitely in the top 3 reasons
I love D.
The code I posted in "Template regexes, version 2" that allows
backtracking over all possibilities in a regex is a great example of
their power.
Try doing what my code does without using inner functions. It will be
much less readable.
-DavidM
More information about the Digitalmars-d
mailing list