[swift-evolution] multi-line string literals

Chris Lattner clattner at apple.com
Mon Dec 14 14:35:06 CST 2015


> On Dec 10, 2015, at 11:07 PM, Travis Tilley <ttilley at gmail.com> wrote:
> 
> Chris - due to the complexity involved, would it make sense to have multiple proposals? One syntax need not fulfill the needs of every use case.

I’m not sure how to interpret this question.  Are you asking whether a proposal should start out simple, then have new things piled on top of it?  Or are you suggesting it would be better to have multiple new language features solving different problems?

In this case, my personal preference is to have a really well thought out long term vision for what we are doing in this space, and then subset the implementation to start with the simple pieces.  This avoids painting ourselves into a corner.  Further, I really hope we can avoid adding N new string literal syntaxes.  I see the existing one as the “simple” case, and the multiline case as the “advanced” case which can have knobs put on it for other advanced uses.

-Chris


> My immediate and personal concern is the simplest possible syntax for multi-line string literals with no behavioral differences from normal string literals other than 1) the ability to span multiple lines and 2) the ability to contain unescaped quotes as long as they are not triple quotes. As additional features, the potential indentation handling previously discussed in this thread would be a massive bonus that'd make life easier.
> 
> Additional proposals for full-on heredoc syntax with both indentation aware and ignoring syntax (as is typical in other languages) could be made and implemented separately.
> 
> I have no use for an escape-ignoring/escape-unrequiring syntax and would have to leave that up to others to flesh out and/or implement. This would make most sense with a heredoc style syntax where the terminator is a very specific string.
> 
> I also have no use for specifying a dialect for a string, which Jordan Rose suggests is useful for shaders, and have no idea how to implement such a feature.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151214/7230d33e/attachment.html>


More information about the swift-evolution mailing list