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); } ----------------- Andrej Mitrovic: > It would be better if you didn't have to specify the argument types. I > think bear asked for templated lambdas, so this could eventually > become: Some related requests (one and half of them is by me): http://d.puremagic.com/issues/show_bug.cgi?id=7357 http://d.puremagic.com/issues/show_bug.cgi?id=7308 http://d.puremagic.com/issues/show_bug.cgi?id=7176 Bye, bearophile