DIP in making: ProtoObject
Jack Stouffer
jack at jackstouffer.com
Wed Apr 4 20:12:08 UTC 2018
On Wednesday, 4 April 2018 at 14:47:03 UTC, Luís Marques wrote:
> Regarding the output range replacing toString. That's an
> obvious improvement. Yet, before that is set in stone, give the
> following at least some thought.
It's a bit late for that ;)
https://github.com/dlang/phobos/pull/5991
> For instance, if you want to print an Object to the terminal
> with some color, you can't use a chain of ranges like
> `yourObject.toString.colorizer`, you have to output to some
> intermediary buffer. Just by coincidence, yesterday I was once
> again wondering about this and I decided to prototype an
> input-range-based formatter. By restricting the initial
> version to a compile-time format string it actually made it
> *very* easy to implement a MVP.
The counter to this is that output ranges are only for finalizing
data that you want to buffered. In the example given, yourObject
should instead have a range generating function which can be
given to colorizer, which is then given to
stdout.lockingTextWriter.
More information about the Digitalmars-d
mailing list