On Saturday, 7 July 2018 at 12:54:03 UTC, kdevel wrote:
On Saturday, 7 July 2018 at 12:46:08 UTC, rikki cattermole wrote:
On 08/07/2018 12:40 AM, kdevel wrote:
Interesting alternative

That was not an alternative.
That is what your code was doing.

What my original code was supposed to do. But it did not compile.

   Error: array index [0] is outside array bounds [0 .. 0]
   Error: string slice [1 .. 0] is out of bounds

My question is if it is intentionally failing to compile a static if guard clause.

The site you cited for the guard clause above (c2.com)
works at runtime. The intention is to shorten the paths inside a function, I think. Therefore, a static "guard clause" is a contradiction, if I understand it correctly.

The constraint in form fun(...)(...) if(...) is a static construct. Therefore, all parts should be mentioned statically. And by

https://dlang.org/spec/version.html#staticif
paragraph: 24.5.4.2

a static if does not introduce a new scope. So, the argument about arrow code is not valid here.

Reply via email to