March 26, 2012 [phobos] std.string.format | ||||
---|---|---|---|---|
| ||||
I'm a little tired of repeating this code snippets over and over again.
string formatString(Args...)(string fmt, auto ref Args args)
{
import std.array, std.format;
auto app = appender!string();
formattedWrite(app, fmt, args);
return app.data;
}
What's the reason that std.string.format defaults to vararg formatting?
_______________________________________________
phobos mailing list
phobos@puremagic.com
http://lists.puremagic.com/mailman/listinfo/phobos
|
March 26, 2012 Re: [phobos] std.string.format | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | It is an old feature. I've proposed to replace it like your snippet, but it was rejected, because of the breaking backward compatibility. Today we (at least I and Andrei) agree with adding new functions, but their names are still debatable. See the discussion in here. https://github.com/D-Programming-Language/phobos/pull/231 We'll welcome your comments. Kenji Hara 2012$BG/(B3$B7n(B26$BF|(B8:31 Martin Nowak <dawg@dawgfoto.de>: > I'm a little tired of repeating this code snippets over and over again. > > string formatString(Args...)(string fmt, auto ref Args args) > { > import std.array, std.format; > auto app = appender!string(); > formattedWrite(app, fmt, args); > return app.data; > } > > What's the reason that std.string.format defaults to vararg formatting? > _______________________________________________ > phobos mailing list > phobos@puremagic.com > http://lists.puremagic.com/mailman/listinfo/phobos _______________________________________________ phobos mailing list phobos@puremagic.com http://lists.puremagic.com/mailman/listinfo/phobos |
Copyright © 1999-2021 by the D Language Foundation