<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, May 16, 2017 at 1:25 PM David Hart <<a href="mailto:david@hartbit.com">david@hartbit.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">The problem I see is that + is an operator of the Standard Library and not part of the core language. I wouldn’t want + to sometimes to be a runtime operation and other times a compile-time operation. No, I really think we need strong language support here.</div></blockquote><div><br></div><div>Why not? Compile-time concatenation of string literals delimited by `+` sounds like a perfectly reasonable compiler optimization.</div><div><br></div><div>Your argument would also state that the compiler should not do constant folding like turning `5 + 7` into `12`, would it not? What makes that situation different?</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br><div><blockquote type="cite"><div>On 16 May 2017, at 22:20, Tony Allevato via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br class="m_8293048738178151611Apple-interchange-newline"><div><div dir="ltr">I agree with Ben—this is something that should just work for all string literals, and those protocols shouldn't be reasons to introduce a different syntax. It would be even more confusing for users to have to understand under which contexts they could use either `+` or juxtaposition and under which contexts they could *only* use juxtaposition.<div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, May 16, 2017 at 12:28 PM Ben Rimmington via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
> On 16 May 2017, at 16:36, Gwendal Roué wrote:<br>
><br>
>> Le 16 mai 2017 à 16:58, Tony Allevato <<a href="mailto:tony.allevato@gmail.com" target="_blank">tony.allevato@gmail.com</a>> a écrit :<br>
>><br>
>> Regarding the C/Objective-C syntax, what would be the advantages over concatenating the strings with `+`?<br>
><br>
> The support for ExpressibleByStringLiteral and ExpressibleByStringInterpolation protocols.<br>
<br>
Would it be possible to have compile-time concatenation of *all* string literals using the `+` operator?<br>
<br>
// Written as:<br>
@available(*, unavailable, message: "Long strings can be bro" +<br>
"ken into two or more pieces.")<br>
// Compiled as:<br>
@available(*, unavailable, message: "Long strings can be broken into two or more pieces.")<br>
<br>
This could also be used with types such as StaticString, which don't have their own `+` operator.<br>
<br>
// Written as:<br>
let s: StaticString = "Long strings can be bro" +<br>
"ken into two or more pieces."<br>
// Compiled as:<br>
let s: StaticString = "Long strings can be broken into two or more pieces."<br>
<br>
-- Ben<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>
_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></blockquote></div><br></div></div></blockquote></div></div>