[swift-evolution] [Review] SE-0168: Multi-Line String Literals

Xiaodi Wu xiaodi.wu at gmail.com
Wed Apr 12 16:31:07 CDT 2017


John, why do you think that option 2 is superior to option 3?


On Wed, Apr 12, 2017 at 16:14 John Holdsworth via swift-evolution <
swift-evolution at swift.org> wrote:

> I think we’re agreeing. Looks like I need to clarify my last post a
> little. When I included the following strings:
>
>         let longstring = """\
>             Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
> do eiusmod \
>             tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
> minim veniam, \
>             quis nostrud exercitation ullamco laboris nisi ut aliquip ex
> ea commodo consequat.\
>             """
>
>         print( """\
>             Usage: myapp <options>
>
>             Run myapp to do mything
>
>             Options:
>             -myoption - an option
>             """ )
>
> These were expressed in term of the proposal after last nights changes.
>
> By advocating option 2) I’m accepting we should revert back to the
> following:
>
>         let longstring = """
>             Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
> do eiusmod \
>             tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
> minim veniam, \
>             quis nostrud exercitation ullamco laboris nisi ut aliquip ex
> ea commodo consequat.\
>             """
>
>         print( """
>             Usage: myapp <options>
>
>             Run myapp to do mything
>
>             Options:
>             -myoption - an option
>             ""” )
>
> 1) Proposal as it stands  - no magic removal of leading/training blank
> lines.
> 2) Removal of a leading blank line when indent stripping is being applied.
> 3) Removal of leading blank line and trailing newline when indent
> stripping is being applied.
>
>
> Also, note: the toolchain does not seem to work at all with playgrounds.
> I’ve been using small test apps.
>
> On 12 Apr 2017, at 21:06, Adrian Zubarev via swift-evolution <
> swift-evolution at swift.org> wrote:
>
> Exactly, I feel like we found a Swifty version of a multi-line string
> literal. :)
>
>
>
> --
> Adrian Zubarev
> Sent with Airmail
>
> Am 12. April 2017 um 21:58:37, Vladimir.S via swift-evolution (
> swift-evolution at swift.org) schrieb:
>
> this:
> """
> one
> two
> """
> should be just the same as "one\ntwo\n"
>
> If one wants some advanced tuning of line ends, he/she can use a
> backslash, for example
> """
> one
> two\
> """
> should produce "one\ntwo"
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170412/edb43c2a/attachment.html>


More information about the swift-evolution mailing list