On Sunday, 29 July 2018 at 14:55:46 UTC, Shigeki Karita wrote:
This library is very similar to Scala or shell scripts.
- https://github.com/ShigekiKarita/stri/tree/master
-
https://docs.scala-lang.org/overviews/core/string-interpolation.html
## example
import stri : s;
// runtime/compile-time variables
auto a = 1;
enum _a0 = "D-lang";
struct A {
static a = 0.123;
}
// you can use the default %s and custom ones e.g., %.3f
mixin s!"${a} is one. ${_a0} is nice. ${A.a%.3f}" i;
assert(i.str == "1 is one. D-lang is nice. 0.123");
Seems fairly similar to `interp` in scriptlike:
https://github.com/Abscissa/scriptlike
BTW it wouldn't be so hard to add string interpolation to the
language and compiler, there have been two PRs now. This was the
latest:
https://github.com/dlang/dmd/pull/7988
I think someone just needs to take a bit of time and write a DIP,
so that A&W can't say no ;-)