(Sorry, sent this to Andrei's private address. Resending to list.) That sounds like a good idea. Should fmt include the '%' character of the format specifier?
-Lars On Mon, 2010-07-12 at 01:38 -0500, Andrei Alexandrescu wrote: > Yah, I was thinking of a unified and backwards-compatible sig: > > string toString(void delegate(const(char)[]) sink = null, > string fmt = null); > > With null inputs toString works like today. When provided a sink, it > outputs to the sink and returns null. > > > Andrei > > On 07/12/2010 01:28 AM, Lars Tandle Kyllingstad wrote: > > This is great, and it was sorely needed! > > > > Have you given any more thought to the issue of user-defined types that > > want to define a more elaborate toString() signature than the trivial > > one? > > > > It seems that with your recent change to output ranges, both > > BigInt-style toString(), > > > > void toString(void delegate(const(char)[]) sink, string fmt); > > > > and Complex-style toString(), > > > > void toString(Writer)(ref Writer writer, string fmt) > > if (isOutputRange!(Writer,string)) > > > > could be supported without making special cases for each. > > > > -Lars > > > > > > > > On Sun, 2010-07-11 at 20:49 -0400, dsource.org wrote: > >> phobos commit, revision 1748 > >> > >> > >> user: andrei > >> > >> msg: > >> Radical overhaul. > >> > >> http://www.dsource.org/projects/phobos/changeset/1748 > >> > >> _______________________________________________ > >> phobos mailing list > >> [email protected] > >> http://lists.puremagic.com/mailman/listinfo/phobos > > > > > > _______________________________________________ > > phobos mailing list > > [email protected] > > http://lists.puremagic.com/mailman/listinfo/phobos _______________________________________________ phobos mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/phobos
