"static" means too many things

Andrej Mitrovic andrej.mitrovich at gmail.com
Tue May 1 17:04:27 PDT 2012


On 5/2/12, bearophile <bearophileHUGS at lycos.com> wrote:
> This is the brief of some D code, it shows one consequence of the
> excessive overloading of the D "static" keyword:

You can almost cheat, but you can't:

struct Foo
{
    bool solve()
    {
        auto fill = function(int r, int c, int x)
        {
            writeln(x);  // can access 'x'

            if (fill(x, y, z))  // error: doesn't find the right 'fill' function
                return false;

            return true;
        };

        return fill(x, y, z);
    }

    int x, y, z;
}

So no recursive calls I'm afraid.


More information about the Digitalmars-d-learn mailing list