[swift-evolution] [Proposal] Eliminating Swift's Screaming Snake Case Identifiers

Dany St-Amant dsa.mls at icloud.com
Fri Jan 22 18:30:30 CST 2016


One thing not mentioned about the current syntax of this obscure #line, is that you can use it on its own to reset to the real line numbers.

print(__LINE__) //  Line 6
#line 2456 "filename"
print(__LINE__) // Line 2456
#line
print(__LINE__) // Line 10

The above currently doesn’t work in Playground (I’m guessing, lines are fed one by one to the compiler/interpreter), but does when properly compiled. So this new concept of using #line as a getter/setter will need a way to reset to real value.

Dany


> Le 22 janv. 2016 à 17:17, Joe Groff via swift-evolution <swift-evolution at swift.org> a écrit :
> 
> 
>> On Jan 22, 2016, at 2:15 PM, Jack Lawrence <jackl at apple.com> wrote:
>> 
>> +1 completely agreed. I would also find it interesting to explore some sort of unified syntax the existing #line and the new #line, where I could read or write to it like (completely strawman syntax):
>> 
>> let line = #line // read
>> #line = (number: 1, file: "/Users/jack/Desktop/coolswift.swift") // write
> 
> That's cute, though it would behave quite differently from other properties, since you could only assign literals, and you could do so in any context. Not necessarily a showstopper problem, just an observation.
> 
> -Joe
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list