I have this piece of code:

template somet(R...) {
  static if (R.length)
  {
string somet = "[\n"~R[0]~"\n" ~ somet!(R[1..R.length]) ~ "]\n";
  }
  else
    string somet = "";
}


void main()
{
  writeln(somet!("name","tame"));
  writeln(somet!"name");
}

When I compile it, it generates the error message "static variable somet cannot be read at compile time". When I replace 'string' with 'const char[]', it works.

Can anyone explain why this happens?

Thanks.
Regards

Reply via email to