Is it possible to use templates to implement something like the `@show` macro from the Julia programming langauge in D?

Salih Dincer salihdb at hotmail.com
Wed Sep 11 19:44:54 UTC 2024


On Wednesday, 11 September 2024 at 18:29:39 UTC, WB wrote:
> This code is about 13 years old, but still works. (It is 
> functional and works, but I never it used more than what is in 
> this repo).
>
> But now that we have interpolation sequences in the language, 
> it would be way easier, cleaner and more powerful to use them.

```d
         assert(echo2("T $i, b, ${i-2}") == "writefln(\"T \", i, 
\", b, \", (i-2));\n");
```

It looks clean and understandable. What is not understandable is 
that it has not been included in std.stdio for over 10 years. I 
know, string interpolation has just been integrated, but why 
hasn't something like this been developed in 10 years that would 
have no side effects and would attract the attention of beginners?

SDB at 79


More information about the Digitalmars-d-learn mailing list