On Saturday, 15 April 2017 at 20:04:13 UTC, Jonas Drewsen wrote:
Hi all

I've been wanting to have support for interpolated strings in D for some time now that will allow you to write e.g.:

auto a = 7;
writeln( $"{a} times 3 is {a*3}" );

Code speaks louder that words so I've made a PR that adds this support to ddmd as a RFC [1].

The compiler will basically lower the $"..." string to a mixin that concatenates the expression parts of the (inside the {}) and the plain text parts.

I do recognize that this is not part of the 2017 H1 plan but I also believe such smaller improvements added regularly can make the language both more productive and attractive.

In case this addition gets a thumbs up I will of course improve test coverage and any needed quality of implementation.

[1] https://github.com/dlang/dmd/pull/6703

Seems like there are mixed opinions about inclusion of a thing like this.

Looking at all the old PRs on dlang github slowly bit rotting it makes me
wonder how not to end up in that pool.

I think that history has shown that Walter/Andrei are gatekeepers on what will ever get into the language. For the sake of contributers (incl. me or course :) ) it would make sense to get a preliminary "never going in" clarification by them early on. Even before a DIP has been written because writing that takes a good amount of effort.

Also collect these declined language change decisions (such as AST Macros) on the wiki for future contributers to scan through before anything else. I volunteer to add "interpolated strings" to the page in case it gets declined. The page could also list pre-approved language changes such as async functions (which Walter wants afaik).

I guess the main question is really to Walter and Andrei if we could get some kind "never going in" or "could be considered" clarification on e.g. news group threads named like e.g. "Language Design Change: Interpolated string"? Based on that the next steps: DIP, PR etc. step would take place.























Reply via email to