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

WB witold.baryluk at gmail.com
Wed Sep 11 22:06:54 UTC 2024


On Wednesday, 11 September 2024 at 19:44:54 UTC, Salih Dincer 
wrote:
> 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

Honestly, D, does not really need it, and most of solutions (like 
above) do have one or few limitations and drawbacks. Some will be 
acceptable in some projects, some not.

There is plenty of stuff in language and library already, adding 
small things like that are not really the best thing. There is 
plenty of very successful languages, that do not offer this (Go, 
C++, Python 3.5 and earlier, Lua, older JavaScript, etc) and just 
adding it will not make D automatically more successful. I feel 
there is too much already in D and standard library, and things 
are added to quickly and eagerly, and years later we end up in a 
mess that cannot be solved (because of compatibility).

Interpolation strings (added this year) are ok and pretty decent, 
and well tough in terms of what one can do with them. We still do 
not know if it is a good or bad design, but we will see. 
Interpolation string are way more powerful, and cleaner, so it is 
good half solution like my mixin echo code was not used as a 
general solution.


If you want to use something, just put it in your own project, 
and it will work to your liking. It does not need to be in a 
standard library.



More information about the Digitalmars-d-learn mailing list