Allow uDLang to do formatting and pretty-printing of plain-text output by providing implementation support for the writer pattern, whose structure will become clear from the following:
The library could then provide primitives like: wrap or join, written in terms of these operations.
The final piece is to mandate implementation support for this protocol in the uDLang CLI tool, perhaps under a flag like --output writer, which would automatically interpret the result. But a short python script which interprets this protocol is provided here below as a poof of concept. Let it be known that, despite the brevity of this example, it took a few tries to get it right. Mutable state is evil.
Problem Statement
Allow uDLang to do formatting and pretty-printing of plain-text output by providing implementation support for the writer pattern, whose structure will become clear from the following:
The library could then provide primitives like:
wrap
orjoin
, written in terms of these operations.The final piece is to mandate implementation support for this protocol in the uDLang CLI tool, perhaps under a flag like
--output writer
, which would automatically interpret the result. But a short python script which interprets this protocol is provided here below as a poof of concept. Let it be known that, despite the brevity of this example, it took a few tries to get it right. Mutable state is evil.