T... args!
Steven Schveighoffer
schveiguy at gmail.com
Fri Apr 29 12:57:15 UTC 2022
On 4/28/22 10:48 PM, Salih Dincer wrote:
> On Thursday, 9 December 2021 at 14:34:58 UTC, Steven Schveighoffer wrote:
>>
>> You may want to post what you want to achieve with your code, instead
>> of examples of what you tried, and it may allow us to make things
>> clearer. You are likely using the wrong construct to achieve your goals.
>
> Hi, sorry to bring up an old topic again, but I'm not a zombie. It's
> true I'm a dinosaur. 😀
>
> What I want to do is: What is supported in many programming languages
> but not in modern D programming language: String Interpolation
>
> I believe this will be done using the template. What is this D template
> called as the special syntax called?
There is no string interpolation in D. You can use a function such as
`std.conv.text` to produce a string given interleaving strings and
items. Or you can use `std.format.format` to make it happen.
It looks like you want to take any number of parameters as a template
parameter comprised of a tuple of strings? That isn't supported. What
you instead created was a tuple with a name that shadows the outer name.
Note that `string` is NOT a keyword in D, it's just an alias (one that
the compiler recognizes specially). So it's possible to redefine string
as a symbol to mean something else.
-Steve
More information about the Digitalmars-d-learn
mailing list