On Tuesday, 28 July 2015 at 21:24:31 UTC, David Nadlinger wrote:
On Tuesday, 28 July 2015 at 15:56:52 UTC, Jonathan M Davis
wrote:
It[Accepting Booleans]'s far more flexible in generic code.
It's the other way round. pragma(inline) has currently *three*
behaviors:
pragma(inline);
pragma(inline, true);
pragma(inline, false);
There is no way to represent those as a single boolean.
The second two states can be. So, you can turn inlining on and
off by feeding it a template argument or the result of a function
or something. But it is true that you'd be stuck with a static if
in the case that you just wanted to set it to the default
behavior. I don't know what you'd do to be able to take an
argument for all three though - maybe a string or just some known
integral value?
I don't know how much it really matters ultimately though, since
I expect that for the most part, the folks who are going to be
using this pragma won't be using it generically.
Personally, I very much doubt that I'll ever use it, since I've
never worked on code that cared about performance so much that
you _had_ to force inlining somewhere. The compiler usually does
a good enough job (though that's with C++ compilers; who knows
how well dmd does).
- Jonathan M Davis