Lazy formatting

Berni44 someone at somemail.com
Tue Feb 2 10:40:52 UTC 2021


On Monday, 1 February 2021 at 00:25:42 UTC, Steven Schveighoffer 
wrote:
> I have often wanted a lazy formatting feature where you aren't 
> allocating but it returns a string-able thing that can be used 
> as an input range. I was surprised that phobos doesn't provide 
> this.

Most implementations in std.format produce the result from left 
to right. It looks like this has been done on purpose, though I 
do not fully understand why. Aside from a few corner cases it's 
mainly formatting floating point numbers, that does not do so 
yet. Pondering whether it's possible to making the floatingpoint 
algorithms completely @nogc I meanwhile think it might be 
possible to produce the results from left to right here too (with 
some local buffers and/or RYU printf or something similar). With 
that, it shouldn't be too difficult to put everything into a lazy 
range. (But still, it's a long road to go.)

Anyway I wonder a little bit what use cases there are for such a 
range?



More information about the Digitalmars-d mailing list