Thread overview
[Issue 24320] Change std.writefln() into a regular variadic function not a template
Jan 05, 2024
Walter Bright
Jan 06, 2024
Walter Bright
Jan 07, 2024
mhh
January 05, 2024
https://issues.dlang.org/show_bug.cgi?id=24320

--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> ---
Arguments like `struct S { int x; int y; }` that have no corresponding format specifier could use `%s` as the format specifier, and then the argument can be wrapped in a template that provides a default toString() method.

--
January 05, 2024
https://issues.dlang.org/show_bug.cgi?id=24320

elpenguino+D@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |elpenguino+D@gmail.com

--- Comment #2 from elpenguino+D@gmail.com ---
Please fix templates instead of implementing awkward workarounds at every opportunity...

--
January 06, 2024
https://issues.dlang.org/show_bug.cgi?id=24320

--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> ---
The build system, of course, will merge identical template instantiations. But the purpose of templates is to provide specializations for their specific arguments, and so they are different and cannot be merged. writefln() can easily create hundreds of slightly different template instantiations, none of which can be merged.

--
January 07, 2024
https://issues.dlang.org/show_bug.cgi?id=24320

mhh <maxhaton@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxhaton@gmail.com

--- Comment #4 from mhh <maxhaton@gmail.com> ---
Have you tried fixing writefln first? If you write a good template it will mostly be reused other the parent instantiation.

--