April 12, 2011
I thought templated functions can be called without a bang if an argument can be deduced to be available at compile time. I know I've read about this somewhere, either TDPL or the docs. So I thought that writef checks the string literal at compile time, not runtime.

Template shenanigans..
April 12, 2011
Andrej Mitrovic:

> I thought templated functions can be called without a bang if an argument can be deduced to be available at compile time. I know I've read about this somewhere, either TDPL or the docs. So I thought that writef checks the string literal at compile time, not runtime.

I think there is some confusion here. Each function call is done fully at compile time or fully at run time, there is no partial compilation. Template arguments always require the bang, and they are always taken at compile-time. Template functions may not require a bang+types if argument types can be inferred from the given arguments.

Bye,
bearophile
April 12, 2011
On 4/12/11, bearophile <bearophileHUGS@lycos.com> wrote:
> Template functions may not require a bang+types if argument types can be inferred from the given arguments.

So isn't the string literal a candidate in this case?
April 26, 2011
On 11/04/11 9:35 PM, Andrej Mitrovic wrote:
> I realize runtime checks would be out of the question...

debug doRuntimeCheck();

:-)
1 2
Next ›   Last »