[swift-evolution] multi-line string literals

Tyler Cloutier cloutiertyler at aol.com
Mon Dec 14 16:15:54 CST 2015


Yes, you are right, Brent, there should be a closing quote on the last line otherwise it would be a syntax error. That’s a much better idea! That would also fix the 

let x = “foo

being valid syntax problem.

Tyler


> On Dec 14, 2015, at 2:10 PM, Brent Royal-Gordon <brent at architechies.com> wrote:
> 
>> let x =
>> "This is a proposal for a multiline literal String in Swift. This syntax solves a number of problems that
>> "are common in other language's implementations of multiline Strings. This syntax is meant to be a
>> "a generalization of regular Swift literal Strings, whereby a String is considered to begin with an open quote
>> "and continue indefinitely until and including the end of the line (newline character),
>> "or the String is closed with an ending quote.
> 
> Damn, why didn’t I think of that? It’s something like my email-style syntax, but based on regular English punctuation conventions instead of Internet ones. (I assume, incidentally, that there’s meant to be a closing quote on the last line, and it would be a syntax error if there weren’t.) 
> 
> You would want a “toggle line quoting” command in your editor, the same way many editors have a “toggle commenting” commandz. In Xcode, the natural keystroke would be Cmd-‘ or Cmd-", but that’s currently used for Jump to Next Issue/Jump to Previous Issue. If this feature is added, hopefully the Xcode guys see how much this needs that mapping.
> 
> -- 
> Brent Royal-Gordon
> Architechies
> 



More information about the swift-evolution mailing list