How about appender.put() with var args?
Messenger via Digitalmars-d
digitalmars-d at puremagic.com
Thu Apr 16 14:58:43 PDT 2015
On Thursday, 16 April 2015 at 03:53:56 UTC, Andrei Alexandrescu
wrote:
>> Sidetracking a bit, but when I started using Appender I was
>> surprised to
>> see that put didn't return a reference to the Appender itself.
>> Had it
>> done so, you could have chained your put calls very nicely.
>>
>> app.put("foo")
>> .put(var)
>> .put("bar")
>> .put(more)
>> .put("stuff");
>>
>> You can naturally write a small wrapper function that does
>> this for you,
>> but it still strikes me as odd. Sadly I imagine changing the
>> return type
>> would make the function signature mangle differently, breaking
>> ABI
>> compatibility.
>
> Does ~= chain? -- Andrei
I'm not sure I understand.
Appender!string app;
app ~= "hello"
~= " "
~= "kitty";
--> Error: Cannot modify '" "'
Is the order of evaluation not such that this becomes app ~=
("hello" ~= (" " ~= "kitty"))?
More information about the Digitalmars-d
mailing list