Talk:String append

From Rosetta Code
Revision as of 15:13, 4 October 2013 by rosettacode>TimToady (my take on the difference between concat and append tasks)

How does this differ from String concatenation? --Spoon! (talk) 09:03, 4 October 2013 (UTC)

This task differentiates those languages that support modify-in-place from those that force a copy (notionally at least). The other task mandates "create another string variable" whereas this one basically says "try not to create another string variable; modify in place if you can, otherwise show how you'd work around that lack of that ability". Of course, internally, both solutions may end up copying if you didn't reserve enough space, but it's the mental convenience that is at stake here, just as in C you can say either "a = a + 1" or "a += 1", and it may or may not compile down to the same thing, but the latter represents the simpler idea of an accumulator, rather than forcing the programmer to think of one thing as both an lvalue and an rvalue. So I'd say this entry is a little more about psychology than the other, which is more about technology. --TimToady (talk) 15:13, 4 October 2013 (UTC)