<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>I think you're seriously over-designing here.<br></div>
<div>&nbsp;</div>
<div>This feature isn't something end users are going to use. And it's not something that will ever reasonably apply to anything except #file and #line. This feature is only ever intended to be used by tools that auto-generate source files. The most important concerns here really should just be that whatever we use is trivial to generate correctly by even the simplest of tools and is readable. And since this won't ever apply to anything beyond #file and #line, there's no need to try to generalize this feature at all.<br></div>
<div>&nbsp;</div>
<div>To that end, since the precedent here is for the compiler directive #line, I repeat my +1 for #setline. It has the verb, which Greg Parker rightly points out is a good idea, and it's the simplest solution that happens to be the closest to the existing precedent (which will help because any tools that generate these directives for multiple languages, or for multiple versions of Swift, only have to include/omit the word "set" instead of generating two completely different directives, and similarly it becomes trivial to take tools that generate #line directives and fix up the output with something like `tool | sed 's/^#line\b/#setline/').<br></div>
<div>&nbsp;</div>
<div>-Kevin Ballard<br></div>
<div>&nbsp;</div>
<div>On Thu, Feb 4, 2016, at 09:55 AM, Erica Sadun via swift-evolution wrote:<br></div>
<blockquote type="cite"><div><div style="word-wrap:break-word;-webkit-line-break:after-white-space;"><div>How about this then?<br></div>
<div>&nbsp;</div>
<div>syntactic-context-statement → #setsyntaxcontext<br></div>
<div>syntactic-context-statement → #setsyntaxcontext&nbsp;syntactic-control-assignments<br></div>
<div>syntactic-control-assignments → syntactic-control-assignments, syntactic-control-assignment<br></div>
<div>&nbsp;</div>
<div>syntactic-control-assignments → syntactic-control-assignment<br></div>
<div>syntactic-control-assignment → line = line-number<br></div>
<div><div>syntactic-control-assignment → file = file-name<br></div>
<div>&nbsp;</div>
<div>* It offers a specific identifier that's unlikely to conflict with future keywords<br></div>
<div>* It enables the grammar to expand for future syntactic control assignments<br></div>
<div>* It adds labels so dropped arguments and arbitrary order are easily disambiguated (thanks BRG)<br></div>
<div>&nbsp;</div>
<div>I know Brent prefers reset to set (#resetsyntaxcontext to #setsyntaxcontext), and wanted to punch that point again here.<br></div>
</div>
<div><div>&nbsp;</div>
</div>
</div>
</div>
<div>-- E<br></div>
<div>&nbsp;</div>
<div><blockquote type="cite"><div>On Feb 4, 2016, at 10:49 AM, Chris Lattner &lt;<a href="mailto:clattner@apple.com">clattner@apple.com</a>&gt; wrote:<br></div>
<div>&nbsp;</div>
<div><blockquote style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;" type="cite"><div><div>&nbsp;</div>
<div>On Feb 4, 2016, at 9:46 AM, Erica Sadun &lt;<a href="mailto:erica@ericasadun.com">erica@ericasadun.com</a>&gt; wrote:<br></div>
</div>
<div>&nbsp;</div>
<div><div style="word-wrap:break-word;-webkit-line-break:after-white-space;"><div>What do you feel about something more like:<br></div>
<div>&nbsp;</div>
<div>syntactic-context-statement → #setsyntaxcontext<br></div>
<div>syntactic-context-statement → #setsyntaxcontext&nbsp;syntactic-control-assignments<br></div>
<div>syntactic-control-assignments → syntactic-control-assignments, syntactic-control-assignment<br></div>
<div>&nbsp;</div>
<div>syntactic-control-assignments → syntactic-control-assignment<br></div>
<div>syntactic-control-assignment → line = line-number<br></div>
<div><div>syntactic-control-assignment → file = file-name<br></div>
</div>
<div><div>syntactic-control-assignment → column = column-number<br></div>
</div>
<div><div>syntactic-control-assignment → function = function-name<br></div>
</div>
<div><div>syntactic-control-assignment → dsohandle = dsohandle-name<br></div>
</div>
</div>
</div>
</blockquote><div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;">&nbsp;</div>
<div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;">Something like this makes sense to me, but only file and line can really be set by this construct.<br></div>
<div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;">&nbsp;</div>
<div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;">-Chris<br></div>
<div>&nbsp;</div>
<blockquote style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;" type="cite"><div><div style="word-wrap:break-word;-webkit-line-break:after-white-space;"><div>&nbsp;</div>
<div>-- E<br></div>
<div>&nbsp;</div>
<div><div><div>&nbsp;</div>
<div><blockquote type="cite"><div>On Feb 4, 2016, at 10:31 AM, Chris Lattner &lt;<a href="mailto:clattner@apple.com">clattner@apple.com</a>&gt; wrote:<br></div>
<div>&nbsp;</div>
<div><blockquote style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:start;text-indent:0px;text-transform:none;white-space:normal;widows:auto;word-spacing:0px;-webkit-text-stroke-width:0px;" type="cite"><div>&nbsp;</div>
<div>On Feb 3, 2016, at 7:29 PM, Brent Royal-Gordon via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br></div>
<div>&nbsp;</div>
<blockquote type="cite"><div>line-control-statement → #line­<br></div>
<div>line-control-statement → #line ­line-number­ file-name­<br></div>
<div>line-number → A decimal integer greater than zero<br></div>
<div>file-name → static-string-literal­<br></div>
<div>&nbsp;</div>
<div>The accepted implementation of SE-0028 disambiguates the two by requiring #line (the control statement) to appear at the first column for the time being. This is a stop-gap solution best remedied by renaming #line.<span></span><br></div>
<div>&nbsp;</div>
<div>Chris Lattner writes, "The core team isn’t thrilled with the magic “first token on a line” whitespace behavior that #line will be getting, and would like someone to start a discussion about renaming the old #line directive to something more specific and tailored to its purpose. &nbsp;&nbsp;Once that name and syntax is settled, we can rename the directive and remove the whitespace rule."<br></div>
<div>&nbsp;</div>
<div>I'd recommend #setline or #linenumber. Starting this thread to solicit other suggestions.<br></div>
</blockquote><div>&nbsp;</div>
<div>I don't love the way the current format has two unlabeled parameters in an arbitrary order. Maybe something more like this?<br></div>
<div>&nbsp;</div>
<div><span style="white-space:pre;"></span>#reset line=50, file="foo.swift"<br></div>
<div>&nbsp;</div>
<div>(I have a soft preference for "reset" over "set" because these are things the compiler changes automatically, but that might be a silly reason.)<br></div>
<div>&nbsp;</div>
<div>Perhaps this could even let you set any combination of the #whatever parameters, so if, for instance, you were writing a parser generator, you could set #function to the name of the rule a particular piece of code came from.<br></div>
</blockquote><div>&nbsp;</div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">Using something like this as the grammar structure makes sense to me, but I’d suggest something more specific (and longer) for this, perhaps:</span></span><br></div>
<div>&nbsp;</div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">#setsyntacticsourcelocation</span></span><br></div>
<div>&nbsp;</div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">or something. :-)</span></span><br></div>
<div>&nbsp;</div>
<div><span class="font" style="font-family:Palatino-Roman"><span class="size" style="font-size:14px">-Chris</span></span><br></div>
</div>
</blockquote></div>
</div>
</div>
</div>
</div>
</blockquote></div>
</blockquote></div>
<div>&nbsp;</div>
<div><u>_______________________________________________</u><br></div>
<div>swift-evolution mailing list<br></div>
<div><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br></div>
<div><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div>
</blockquote><div>&nbsp;</div>
</body>
</html>