Interpolated strings
Stanislav Blinov via Digitalmars-d
digitalmars-d at puremagic.com
Sat Apr 15 17:25:19 PDT 2017
On Saturday, 15 April 2017 at 23:58:18 UTC, Adam D. Ruppe wrote:
> On Saturday, 15 April 2017 at 23:11:42 UTC, Stanislav Blinov
> wrote:
>> How about... it removes an import or two?
>
> It doesn't actually remove the dependency, it is just syntax
> sugar over it (there is precedent for this in the language, the
> pow operator calls a Phobos function, but it means you don't
> actually gain decoupling of modules).
As presented, it doesn't. But it can be implemented in a way that
it does. The compiler is capable of conversions without ever
needing std.conv, and if custom .toString() is required, it will
already be available anyway.
As to the importance of this, I can only suggest measuring the
code, both public and your own.
Constructing a string out of variable values without any special
formatting is, in my experience, a very common operation. Do
importing a module *just* to build a mixin without building a
mixin to build that mixin, static error message or a result for a
script; CTFE evaluating a good deal of general-purpose code for a
trivial use case have to be common as well?
More information about the Digitalmars-d
mailing list