[swift-evolution] multi-line string literals.

Dave Abrahams dabrahams at apple.com
Wed Apr 27 13:14:56 CDT 2016


on Wed Apr 27 2016, "L. Mihalkovic via swift-evolution" <swift-evolution at swift.org> wrote:

> Somehow I find the fundamental asymetry of this syntax disturbing for the eye
> (many years of programming have created this silent but real expectation that "
> should match). The thought that it might be trying to mimic "english prose" does
> not make it suddenly look pretty or likeable. But again I probably have no taste
> as I used to find heredoc in perl/shell, if not pretty, at least practical.
> I think what I find surprising is what I perceive as a
> what-we-give-with-the-left-hand (the promise of a convenient way to insert
> existing external text), we-take-back-with-the-right: yes you can insert text,
> but you will have to massage it so much that you are going to be detered from
> using it for anything past 10 lines.

FWIW, this syntax may also be difficult for various editors, IDEs,
scripts, and pretty-printers to adjust to.  One benefit of Python's
triple-quoted syntax is that applying the usual rules for string
recognition results in getting the boundaries of a multi-line string
correct to within a couple of characters, and syntax highlighting always
works.

-- 
Dave



More information about the swift-evolution mailing list