On Tue, May 16, 2017 at 6:47 AM Adrian Zubarev via swift-evolution < swift-evolution@swift.org> wrote:
> Well the main complain I had during the discussion with David was, that I > previously had such a model in mind which will break up long double-quoted > string literals. Please look up this design in the alternative section of > our proposal. By adding slightly redundant multi-line string literal syntax > for consistency renders that complain to zero. By allowing: > > " > SELECT 'name' > FROM 'people' > WHERE age > 20 > " > > it becomes clear that the trailing backslash should only be used for > escaping new line injection in multi-line string literals, but not for > breaking up long strings (similar to other languages like JavaScript): > > "SELECT 'name' \ > FROM 'people' \ > WHERE age > 20" > > This also lets us adopt the C/Objective-C syntax instead. > > "SELECT 'name' " > "FROM 'people' " > "WHERE age > 20" > > Regarding the C/Objective-C syntax, what would be the advantages over concatenating the strings with `+`? All I can see is that it saves two characters per line—is that sufficient to warrant adding another way of doing the same thing? They're available in C/Obj-C because `+` for string literals *wasn't* available, but since Swift does support `+` for string literals, I think it's hard to rationalize adding this. > > -- > Adrian Zubarev > Sent with Airmail > > Am 16. Mai 2017 um 15:02:06, Gwendal Roué via swift-evolution ( > swift-evolution@swift.org) schrieb: > > I wonder whether this addition was introduced in order to make the > proposal as consistent as possible, and prevent some criticisms. It has > proven pointless. I suggest forgetting about pleasing people who don't want > to be pleased, and to reconsider this "divorce" section. Consistency is not > the main point. The main point is UX. This means easing the daily life of > code writers, and easing the daily life of code readers (this involves > being careful which text editors and code prettyfiers are unable to handle > the proposal). > > > Support escaping newlines in multi-line strings with a trailing \ > > Great. That's the main request, unless I'm misled: split long literals > accross multiple lines. > > Now that Xiaodi Wu has found them, the core team questions about the > trailing backslash should be addressed in more details. > > > Adopt the C/Objective-C syntax that concatenates single-line strings > > A battle-tested solution. Doesn't it look redundant with both the > "divorce" and the trailing backslash? > > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution >
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution