It really amazes me what some people think multiline strings are.

For me, the *definition* of a multiline string is this: """A multiline string 
allows you to copy&paste most text, without having to use any special string 
quoting rules: that's the primary use case. For example, you can embed 
something like <span class="stronger" id='highlighted_bit'>HTML Tags with 
different quotes in it</span>, without needing any special care. Some 
not-so-common things may still need quotation, like 3 Quotes in a row, but most 
XML-snippets, JSON-text or Email-Headers can be pasted as-is."""

If you guys have another definition, then please share with us and enlighten 
us: What is the purpose (use case) of having multiline string literals then? 
And what is the definition of a multiline string literal? It seems  (to me, at 
least) like some people just introduce a new string literal syntax and call it 
"multiline".

I'm really not very demanding on this issue. I would be happy with """3 
quotes""", '''3 single quotes''', <<HERE_DOCS, <<'HERE_DOCS', q{perl style 
{balanced quotes} that also allow {{arbitrary} nesting}}; «Guillemets would 
also be nice», maybe combined with “English typographical quotes”, you usually 
don't use both in a string. My personal opinion would be to use <<HERE_DOCS for 
multiline literals with string interpolation (but without any escape sequences 
except \\ for \), and <<'HERE_DOCS' for multiline literals without any string 
interpolation or escape sequences at all (like 'bash string literals'). But the 
users who prefer a quoting style that requires each line to start with a 
specific token (wether it's " or \\) don't like any of the """quotation 
examples""" that I presented, right?

Regards,
Michael

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to