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

Chris Lattner clattner at apple.com
Wed Jan 27 00:51:35 CST 2016


> On Jan 26, 2016, at 6:13 PM, Joseph Lord <joseph at human-friendly.com> wrote:
> 
> Module information would be useful for a logging library, possibly to print the information but possibly also to allow different log levels (e.g. info, debug, warning, error, criticalError) to be configured for each module in a project so that log spam is manageable and possibly adjustable at runtime. (I have a fuller logging idea but have noted it is the example of out of scope and decided not to argue at this point). 

Ok, but why can’t you split that off the front of the symbol name?  The advantage of providing a fully qualified symbol name is that it allows users of this feature to get exactly the information they want.  Unlike my suggestion below, it should also include parameter type information, so it can identify overloads properly.

Splitting out module, type, method, or other information is prone to issues given that we allow nesting of types, nesting of functions, and perhaps nesting of modules some day.  Providing all of the different things that clients could want seems like a never-ending problem.

-Chris

> 
> Joseph
> 
> 
>> On Jan 26, 2016, at 11:58 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> 
>>> On Jan 26, 2016, at 1:48 PM, Erica Sadun <erica at ericasadun.com> wrote:
>>> 
>>> What do you think of:
>>> 
>>> #file, #lineNumber, #column, #symbol (e.g. Swift.Dictionary.init), #module, #contextDictionary
>>> 
>>> and calling it a day?
>>> 
>>> * using contextDictionary allows expandability and can subsume all existing context elements, indexed presumably by the same names
>>> * renaming function to symbol takes care of self.dynamicType as well
>>> * file and lineNumbers are gimmes
>>> * column is apparently well liked by some (not going to kick someone's dog on this)
>>> * adding module fills a big hole.
>>> 
>>> No tuples for Doug, covers some of Chris's points.
>> 
>> I mentioned this in the pull request:
>> 
>> I'd suggest:
>> (file: String, line: Int, column: Int, symbol: String)
>> 
>> Where symbol would be the fully qualified name like "Swift.Dictionary.init”.
>> 
>> 
>> I’m curious to hear what Doug’s concern about using tuples are.  Also, what is the use-case for #module?
>> 
>> -Chris
>> _______________________________________________
>> 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