How about appender.put() with var args?

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 15 13:58:09 PDT 2015


On 4/15/15 4:34 PM, "=?UTF-8?B?Ik3DoXJjaW8=?= Martins\" 
<marcioapm at gmail.com>\"" wrote:
> On Wednesday, 15 April 2015 at 19:16:55 UTC, Steven Schveighoffer wrote:

>> What about:
>>
>> import std.format;
>> app.formattedWrite("foo%sbar", var);
>
> Well, but wouldn't that incur the cost of parsing the format
> string, for no benefit?

The benefit is, you are not limited to strings :P

But yeah, if it's just strings, you have not much benefit. However, I 
don't know what the cost is for parsing compared to the rest, it may not 
be too significant.

I like Ali's idea, make it a general purpose "putAll" primitive, goes 
right in std.range.primitives.

-Steve


More information about the Digitalmars-d mailing list