On 2017-04-18 10:50, Walter Bright wrote:
It may not be necessary to have any dependencies on any import.
$"{a} times 3 is {a*3}"
could be rewritten by the parser to:
"%s times 3 is %s", a, a * 3
and that is that. (I.e. just an AST rewrite.) It would be quite a bit
simpler than Jonas' proposed implementation.
Then you would be forced to wrap it in a function call, to "format" or
similar. The example of using "writeln" is not the best, a more useful
example is when not printing the string immediately. For example:
auto s = $"{a} times 3 is {a*3}";
With your example that would need to be written as:
import std.format;
auto s = format($"{a} times 3 is {a*3}");
--
/Jacob Carlborg