On Monday, 31 July 2017 at 15:57:28 UTC, Anonymouse wrote:
On Monday, 31 July 2017 at 15:46:47 UTC, inevzxui wrote:
On Monday, 31 July 2017 at 15:43:21 UTC, Martin Tschierschke wrote:
[...]
But the parameters are not checked at compile-time unless you specifically pass the pattern string as a template parameter. I think its immutability implicitly converting it into a template parameter is what's what he's talking about.

import std.stdio;

void main(string[] args)
{
    writefln!"%s"(); // compile-time assert
writefln("%s"); // runtime exception, though everything needed for a compile-time assert was inferable during compilation
}

This is exactly the "use case", I thought about: How to avoid runtime errors, if at compile time the problem might be detected.

Reply via email to