On Tuesday, 4 April 2017 at 05:36:55 UTC, evilrat wrote:
On Tuesday, 4 April 2017 at 05:18:26 UTC, Dukc wrote:
On Tuesday, 4 April 2017 at 02:43:26 UTC, evilrat wrote:
[...]

But if all you want is to construct some code in interpreter-like way at compile time, string mixin does precisely that.

No, just static symbols will be enough. Not really interpreter but common day-to-day things like print some formatted stuff while keep it readable.

I know it is easy to do with string.format() but it'll add more commas, templates, mixins or all at once, which is without decent tools like Visual Assist for C++ doesn't really makes it better.

void printStuff()
{
int someInt = calcSmth();
string someName = getSmthDisplayName();
// ... do other things ...
writeln("Your item: {#someName} = {#someInt}");
}

writeln("Your item: ", someName, " = ", someInt");

????

Reply via email to