std.format with wstring and dstring

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Mon Sep 8 01:09:02 UTC 2025


std.format is on my list of modules that I want replaced.

Its written with a lot of error conditions, rather than just adapting to 
the inputs. Hence lots of potential for exceptions being thrown that 
don't need to be.

Multiple multipliers in ``formattedWrite``: format string, output range.

What I'd like to do is to force IES for one or more values, if you want 
finer grained control you want do one value a time (``formatValue``).

```d
writeln(i"$i ${i:X}: $(j + 1)/${(j + 1):X} $1 ${0:X}", k, obj, "atend");
```

Require the use of a string builder, rather than any old output range.
This is a required change for pretty printing. It requires the use of 
arbitrary inserts and removals that ranges can't do.

Every template parameter like these that you have is a multiplier of 
instances, and that isn't good for compile times. Simplifying them down 
may seem like a pain, but it helps quite significantly. Given that there 
are some clear requirements and use cases we can in fact simplify it 
without hurting anyone enough to care.


More information about the Digitalmars-d-announce mailing list