bearophile wrote:
Andrei Alexandrescu:

Sorry, this stays.

Then I'm not going to use the Phobos printing in all my future D2
programs. As I was not using it in D1. I'm not going to change idea
on this.


(e.g. the comma may be a decimal point in some languages, so is
[1,2] in a German locale an array of double with one value or two?<


In German you need no space after the comma, and there's no [] after
and before it. So [1, 2] is not a floating point value in German.


Why one space?<

Because that's they way people print things in natural languages.
It's a convention, you know. And it's a good one. It tells apart the
FP numbers and it's the minimal.


It's the most neutral thing I could think of. Why no brackets?
Because of minimalism. You can very easy add them if you want
them.<

The purpose of things like the square brackets is to give a less
ambiguous textual representation of the most common data structures
(array and strings are the most common after numbers). So you put ""
or '' around strings and [] to know what you are printing.

Your choice of leading/trailing symbols and of separators makes 'to' friendlier for printing e.g. debug strings. My choice makes it a primitive for text serialization. I'm not 100% sure which is the more frequent use and therefore which is the most appropriate as a default, but I'm leaning towards the latter.

Andrei

Reply via email to