Challenge: write a template-instance free dispatcher for text printing

Adam D. Ruppe destructionator at gmail.com
Mon May 25 15:35:23 UTC 2026


On Monday, 25 May 2026 at 15:19:51 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
> So let's see if D can do it, but... There are two rules.

Use D1's writeln, it was a runtime variadic instead of a template.


>     dispatcher("prefix", i" $(someVar)/$(someVar) = $(text) ", 
> "suffix");

something like this is what my arsd.core thing does:
https://github.com/adamdruppe/arsd/blob/master/core.d#L11053

it reduces most input to small, factored helper functions to 
minimize generated code. also supports formatting via a wrapper:

	assert(toStringInternal(5.4364.formatArgs(precision: 2)) == 
"5.44");



More information about the Digitalmars-d mailing list