DIP9 -- Redo toString API

bearophile bearophileHUGS at lycos.com
Fri Nov 19 06:14:07 PST 2010


Steven Schveighoffer:

> I've made suggested changes, please review again.

Good, thank you.

Just a note: a DIP is a public document so it's better to encourage good idioms inside it. "null" to represent empty arrays/strings is a bad practice, so instead of this:

   void writeTo(scope delegate(in char[] data) sink, string format = null) const
   {
      formattedWrite(sink, "(%s, %s)", first, second);
   }


I suggest you to write something like:

   void writeTo(scope delegate(in char[] data) sink, string format="") const
   {
      formattedWrite(sink, "(%s, %s)", first, second);
   }


More info about it:
http://d.puremagic.com/issues/show_bug.cgi?id=3889

Bye,
bearophile


More information about the Digitalmars-d mailing list