[swift-evolution] [Discussion]: Renaming #line, the line control statement
erica at ericasadun.com
Wed Feb 3 19:24:30 CST 2016
Swift Evolution SE-0028 (https://github.com/apple/swift-evolution/blob/master/proposals/0028-modernizing-debug-identifiers.md <https://github.com/apple/swift-evolution/blob/master/proposals/0028-modernizing-debug-identifiers.md>) overloads
the use of #line to mean both an identifier that maps to a calling site's line number with a file and acts as part of a line control statement with the following grammar:
line-control-statement → #line
<>line-control-statement → #lineline-number <https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html#//apple_ref/swift/grammar/line-number>file-name <https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html#//apple_ref/swift/grammar/file-name>
<>line-number → A decimal integer greater than zero
<>file-name → static-string-literal <https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/LexicalStructure.html#//apple_ref/swift/grammar/static-string-literal>
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.
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. Once that name and syntax is settled, we can rename the directive and remove the whitespace rule."
I'd recommend #setline or #linenumber. Starting this thread to solicit other suggestions.
Best, -- E
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution