About Strings

Tor Lillqvist tml at iki.fi
Tue Mar 20 08:50:36 PDT 2012

> To me, both look equally wrong if OUString is considered immutable, and
> equally OK if it isn't.

Ah, but if you let your C# (or Java?) exposure influence you, foo =
foo + bar looks ok even if OUString is considered immutable. The old
object that the foo variable refered to is lost (unless it had other
references), and foo is set to refer to a new object which is the
concatenation of the old foo and bar. Not any stranger than tem = foo
+ bar; foo = null.

But foo += bar looks weird, as it seems to say that the immutable
object that foo refers to gets something appended to it.

At least thinking of C# is how I explain to myself why I like one but
not the other... But sure, I know that variables and objects in C++ is
a completely different thing than in C# or Java, despite superficial


More information about the LibreOffice mailing list