[swift-evolution] multi-line string literals.

Peter Dillinger Peter.Dillinger at synopsys.com
Mon Apr 3 12:46:54 CDT 2017


> H3) No recovery for tokenization / syntax highlighting.  IMHO, this is the big drawback of Python-style """ strings.

A key way this manifests is while typing your program.  When you type the opening """, the rest of the text in the file is going to be "inverted" between code and multiline strings (multiline strings will appear as code and code as multiline strings) which is really ugly and can slow down your IDE with re-parsing and error generation / highlighting.  Continuation characters enable much cleaner handling of the "incomplete program" case, but I believe my proposal comes close enough, because resumption of code can be assumed at the next reduction in indentation (usually the next '}') or multiline string close sequence (''' or ///).

-- 
Peter Dillinger, Ph.D.
Software Engineering Manager, Coverity Analysis, Software Integrity Group | Synopsys
www.synopsys.com/software

 


More information about the swift-evolution mailing list