<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">So discussion of the exact naming convention for access modifiers has been discussed multiple times, especially when fileprivate was being introduced. It's now been a while since fileprivate was added, so we've all had more time to actually work with it, so I wanted to raise the discussion again to see what people now think.<div class=""><br class=""></div><div class="">Specifically, during the debate over access modifiers I really didn't like the propose fileprivate, as I don't like conjoined lower-case key-"words" (to me a keyword should always be a single word, I still don't like associatetype or typealias either, and neither does macOS' auto-correct ðŸ˜‰). And to be honest my opinion hasn't changed; if anything I hate it even more.</div><div class=""><br class=""></div><div class="">The proposal I preferred was to use only the public and private keywords and use parameters to provide greater specificity, like so:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>public<span class="Apple-tab-span" style="white-space:pre">                        </span>as it is now</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>private(module)<span class="Apple-tab-span" style="white-space:pre">        </span>equivalent to internal, which is private to the current module/project</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>private(file)<span class="Apple-tab-span" style="white-space:pre">                </span>equivalent to fileprivate</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>private(scope)<span class="Apple-tab-span" style="white-space:pre">                </span>equivalent to current private</div><div class=""><br class=""></div><div class="">The actual parameters are up for debate, but I still feel this a lot clearer. I also generally prefer the parameterised version for several reasons:</div><div class=""><br class=""></div><div class=""><ul class="MailOutline"><li class="">Readability: I know not everyone will agree on this one, but I much prefer the separation to having conjoined keywords.</li><li class="">Fewer Keywords: Maybe I'm a keyword purist or something, but I just don't like having too many keywords in the language, especially four for what amounts to a single feature (access).</li><li class="">Extensibility: It is easier and cleaner to add more parameters in future. For example, private(type) could be an equivalent to protected access in other languages. It can also be used to more easily group external extension modifiers under public such as public(final), public(open) etc.</li></ul><div class=""><br class=""></div><div class="">For setter-specific access it might look something like:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>private(file:set) var someValue:Int = 0</font></div><div class=""><br class=""></div></div><div class="">I know it might not seem that important to some people, but this is one area of Swift's syntax that still bothers me, perhaps unreasonably so, but I don't get to pick what annoys me! I'd also seek to replace associatedtype and typealias (and any other conjoined keyword I've forgotten) but I haven't thought of any alternatives that I like for those yet.</div><div class=""><br class=""></div><div class="">Anyway, just wanted to discuss how others felt having used fileprivate and such for a while, and whether it's worth revisiting, or if I just have to live with it.</div></body></html>