[swift-evolution] multi-line string literals

Rainer Brockerhoff rainer at brockerhoff.net
Wed Dec 16 07:24:08 CST 2015


On 12/14/15 20:40, swift-evolution-request at swift.org wrote:
> Date: Mon, 14 Dec 2015 12:38:14 -0800
> From: Chris Lattner <clattner at apple.com>
> Subject: Re: [swift-evolution] multi-line string literals
> Message-ID: <509AEA5D-81C8-48A5-B676-B059624ED4E3 at apple.com>
> 
>> > On Dec 11, 2015, at 4:03 PM, Travis Tilley <ttilley at gmail.com> wrote:
>> > Fair enough. Plus if Chris Lattner has any strong opinions about the behavior of single quotes, which might be the case given the existing code for handling them in Lexer.cpp, backticks are a damn good alternative. I'd still like to wait to hear back from him or someone else on the core team about that one.
> 
> Support for single quoted literals like 'x' was a legacy feature for C-like character literals that we explored before the design of Character went to where it is now.  I’d be fine ripping it out and repurposing it.

IIRC the problems with C character literals began when they began to
generalize the original concept of representing a single ASCII character.

Repurposing 'x' to something like multiline strings might be confusing
to people migrating from other languages, but perhaps refocusing on the
original usage would not be?

IOW, 'x' where x must be a Character, that is, an extended Unicode
grapheme cluster — represented in the source code as UTF8 or with the \u
notation. A shortcut for typing Character("x").

-- 
Rainer Brockerhoff  <rainer at brockerhoff.net>
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
In their own business even sages err."
http://brockerhoff.net/blog/


More information about the swift-evolution mailing list