[swift-evolution] [Review] SE-0168: Multi-Line String Literals
david at alkaline-solutions.com
Tue Apr 11 12:28:06 CDT 2017
> On Apr 9, 2017, at 8:44 PM, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
> To back up that last point, I ran through the thread and tried to quickly figure out what everyone was thinking. These people seem to be opposed to the proposal:
> 2. David Waite wants a suite of different, orthogonal string literal features to get enough flexibility.
To be totally accurate, I think even amongst the “evolutionaries” there is a broad sets of requirements, and without reducing that set of requirements you won’t get a single approach with enough flexibility to meet everyone’s needs.
If the goal was a minimal set of options, it would probably require us to determine a set of (I’m guessing three) use cases that multi-line string literals are desired for, and attempting syntax for each of those.
An example use which might or might not make the cut:
"When building email responses or a command-line app, I want to make sure I control the formatting of output messages such that they fit properly on an 80-column-width terminal. I am developing in a text editor that displays a ruler at the 80 column mark and uses a monospaced font. I thus want to output text so that it has no prefix character and is unindented, starting at column 0. Ideally, the text can be copied/pasted without syntax-driven changes, so that I can send it around for external content edits.
As I typically write command-line apps as swift files rather than compiled into binaries, it is desirable to have the text self-contained, rather than as an external resource”
(I suspect a similar use case is the motivation behind python’s syntax)
More information about the swift-evolution