On Monday, 13 February 2012 at 14:14:38 UTC, bearophile wrote:
Zach the Mystic:

void setRandomColorPair( ref ColorPair cp )
{
    import std.random;
    ubyte u(int a, int b) { return cast(ubyte) uniform(a,b); }

Where possible it's good to add "static" to nested functions:

static ubyte u(in int a, in int b) pure nothrow { return cast(ubyte) uniform(a,b); }

I sorta figured D would implicitly attribute "static" to nested functions if the function didn't use any variables outside it's scope. Is that not so? Why are you saying it's a good idea to use "static" exactly?


Reply via email to