On Wednesday, 26 February 2020 at 09:45:55 UTC, Walter Bright wrote:
void f(string s, int i = 0);
f(i"hello $a"); // silent unwanted bahviour.

?

It is lowered to:

  f("hello %s", a);

as designed. I don't know what's unwanted about it.

void print_many(string msg, int cnt = 1) {
    foreach(i; 0 .. cnt) writeln(msg);
}

int apple_cnt = 4;
print_many(i"I have $apple_cnt apples.");

expected: I have 4 apples.
real (unwanted) output:
I have 4 apples.
I have 4 apples.
I have 4 apples.
I have 4 apples.

Reply via email to