[swift-evolution] [Discussion]: Renaming #line, the line control statement

Erica Sadun erica at ericasadun.com
Thu Feb 4 09:04:54 CST 2016


> On Feb 3, 2016, at 8:29 PM, Brent Royal-Gordon <brent at architechies.com> wrote:
> 
>> line-control-statement → #line­
>> line-control-statement → #line­line-number­file-name­
>> line-number → A decimal integer greater than zero
>> file-name → 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. 
> 
> I don't love the way the current format has two unlabeled parameters in an arbitrary order. Maybe something more like this?
> 
> 	#reset line=50, file="foo.swift"
> 
> (I have a soft preference for "reset" over "set" because these are things the compiler changes automatically, but that might be a silly reason.)
> 
> 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.
> 
> 

I like the idea of generalizing this a lot more than just going with #setline, which is otherwise currently the most popular response in this thread.

-- E


More information about the swift-evolution mailing list