[swift-evolution] multi-line string literals
ttilley at gmail.com
Mon Dec 14 16:44:53 CST 2015
On Mon, Dec 14, 2015 at 5:27 PM, Travis Tilley <ttilley at gmail.com> wrote:
> On Mon, Dec 14, 2015 at 5:14 PM, Andrey Tarantsov <andrey at tarantsov.com>
>> 2) using ' means that the string contents are unescaped/raw
>> I wonder if that's too subtle. Like Chris, I would prefer advanced knobs
>> to be (i) more distinctive than ' vs ", and possibly (ii) only attached to
>> the advanced string type.
> Anyone coming from ruby would feel right at home, but i'm having trouble
> finding precedent in any other language for that behavior. You may be right.
Then again, similar behavior in python (prefixing a string with r to
qualify it as a 'raw' string) would be completely unintuitive because
backslash behavior is... weird. For example, r"\" is not a valid string.
You can't have a string that's just a backslash just in case it can be
processed as an escape even though raw strings aren't supposed to process
escapes. Some other things are weird... So having blanket "yes, it's really
raw" behavior -might- be unintuitive for people coming from python.
BUT... And this is a massive but... It -would- tie into the discussion that
currently exists for typed literals (something i'm currently mostly
ignorant of and would love to hear more about). Especially since it would
put the qualifier in front of the literal.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution