If you haven’t signed up for the many Swift mail lists, you may want to reconsider. Yes, your in-box will be completely bombed, and the signal to noise ratio is not ideal, but there are some really great discussions going on right now just after the open source launch.
One discussion that caught my eye today involved marking symbols as optionals. I’m not particularly enthused about this suggestion. The proposed idea is to introduce “greater readability” (the marker would instantly identify a symbol as storing an optional value) and allow compiler checks for errors in use.
While I don’t think this would would be a valuable language change, it did get me thinking about symbol conventions. At this point, the only symbol convention I know of that is widely used both inside and outside Apple is the underscore prefix to mark unpublished/private symbols.
For example in the standard library, you find items like
public protocol _SinkType
The underscore prefix convention indicates symbols that aren’t meant for general consumption by third parties.
This got me wondering. Are there other common conventions you’re using in your Swift code to mark symbols? For example, I don’t see Hungarian notation being used widely, even for k-constant prefixes. (Maybe one or two has snuck into my code, but they didn’t stay. I think.)
Instead, I see Swift moving proactively to remove excess linguistic fluff. As part of the Swift programming language audits and evolution, Cocoa is adopting more Swifty™️ naming conventions and dropping many NS prefixes.
In such a philosophy, is there room for extra symbol lint? Or does the utility of symbol annotation outweigh cleaner looking but less intelligable code?
You tell me. Drop a note in the comments, tweet, or send an email. I’d really like to hear what conventions you’ve adopted and how they turned out!