[swift-evolution] multi-line string literals.
me at benrimmington.com
Mon Apr 3 14:25:59 CDT 2017
> On 3 Apr 2017, at 17:55, Tony Allevato wrote:
> I just checked with -O and without and was surprised to find that `let x = "abc" + "def" + "ghi"` wasn't collapsed into a single string literal "abcdefghi" in the generated assembly code. Maybe it's more difficult than it is in some other languages because of operator overloads and different kinds of text literals (strings, extended grapheme clusters, Unicode scalars)?
Is this a regression since Swift 2.0 added the optimization?
* Concatenation of Swift string literals, including across multiple lines, is
now a guaranteed compile-time optimization, even at `-Onone`. **(19125926)**
More information about the swift-evolution