Don escribió:
Ary Borenszweig wrote:
bearophile wrote:
Ary Borenszweig:
res ~= res ~= "\n\treturn
cast(${iface})cast(void*)&_iface_${iface}_vtbl;";
Have you tried std.metastrings.Format!()? I use it quite often.
template Format(A...)
Formats constants into a string at compile time. Analogous to
std.string.format().
Parameters:
A = tuple of *constants*, which can be strings, characters, or
integral values.
I want it in runtime. I basically want this:
foo = `Hello ${var}!`;
or
foo = `Hello $var!`;
to be the same as:
foo = `Hello ` ~ var ~ `!`;
You can see in this trivial example how readability is improved (and
you type less), and in a bigger example (like the one in this thread)
it should be better.
More than a year ago, I created a CTFE function dollar() to do that.
It's a very simple. No language support is required.
foo = mixin(dollar("Hello $var!"));
We just need a way to get rid of the "mixin(" bit.
That's cool!
Yeah, the mixin(dollar( )) stuff is too long... But it's nice that this
can be done at compile time. :-)