String Interpolation
Nick Treleaven
nick at geany.org
Sun Oct 22 20:21:54 UTC 2023
On Saturday, 21 October 2023 at 12:44:51 UTC, Richard (Rikki)
Andrew Cattermole wrote:
> Doing so ties it to a specific formatting library.
>
> Which isn't acceptable, we need to remove coupling between the
> language and druntime let alone Phobos. Its nothing but trouble
> coupling the language to a library especially for a language
> feature which doesn't need to be.
If the string conversion function is a template then there's no
dependency unless it is actually needed. Allocating a string is a
fundamental part of D. Wanting a string from an interpolated
string is likely the most common case. Doing this must not
require importing a function from anywhere, otherwise I might as
well not use an interpreted string and save myself writing an
import. So at minimum, the interpolated string must support a
method suffix to request a string. That method can be a template
so interpolated strings can still be used in @nogc, betterC, etc.
More information about the Digitalmars-d
mailing list