<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br></div><div>On Dec 28, 2016, at 11:36, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div dir="ltr">On Wed, Dec 28, 2016 at 2:29 PM, Micah Hainline via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class="gmail-">> SE-0039 says that resourceName should be a static-string-literal<br>
<br>
</span>It compiles just fine for me in my project. My next question was going<br>
to be do we actually need a change in the language spec, or can we<br>
call fixing that a bug, I think you're answering my question for me<br>
before I even had to ask it!</blockquote><div><br></div><div>I'd call that a bug. It doesn't run, and there's no reason why something not allowed by the grammar shouldn't be diagnosed at compile time, IMO.</div><div><br></div><div>From _The Swift Programming Language_:</div><div><br></div><div><div>GRAMMAR OF A STRING LITERAL</div><div>string-literal → static-string-literal | interpolated-string-literal</div><div>static-string-literal → "quoted-textopt"</div><div>quoted-text → quoted-text-item quoted-textopt</div><div>quoted-text-item → escaped-character</div><div>quoted-text-item → Any Unicode scalar value except ", \, U+000A, or U+000D</div><div>interpolated-string-literal → "interpolated-textopt"</div><div>interpolated-text → interpolated-text-item interpolated-textopt</div><div>interpolated-text-item → \(expression) | quoted-text-item</div><div>escaped-character → \0 | \\ | \t | \n | \r | \" | \'</div><div>escaped-character → \u{unicode-scalar-digits}</div><div>unicode-scalar-digits → Between one and eight hexadecimal digit</div></div></div></div></div></blockquote><br><div>I'm a bit surprised that part of compiling the compiler doesn't seem to involve parsing these kinds of grammar specs directly to generate the code used to identify literals. (Or maybe it does and and we just forgot to sync up the grammar specs and the docs before the last release.)</div><div><br></div><div>- Dave Sweeris</div></body></html>