This is contrary to several deliberate design decisions, if I understand correctly.<br><br>First, revisions to visibility rules in the Swift 3 timeline were made with the deliberate intention that it should be possible to model greater visibility within a type (e.g. public members) without actually exporting that type. As Swift does not have optional warnings that can be turned off, it would be incongruous if the language also warned users away from creating internal types or variables before they are used. Unlike warnings about unused variables within a scope, which are by definition local, a warning such as proposed would be much more disruptive.<br><br>Second, a variable with no access modifier defaults to internal, and this is deliberate for the purpose of progressive disclosure (i.e. it is, by design, possible for a new user to write useful code separated across multiple files without learning what access modifiers are). This would be undone if nearly every such use prompted a warning.<br><br>In summary, I think the issue here is more one of style than safety, and IMO is more within the scope of a linter.<br><br><div class="gmail_quote"><div dir="ltr">On Wed, Jan 25, 2017 at 12:27 Robert Widmann via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" class="gmail_msg"><div class="gmail_msg">So, to be clear, a warning about making internal variables more private based on their usage in the entire module? </div><div id="m_-4942221354445230965AppleMailSignature" class="gmail_msg"><br class="gmail_msg"></div><div id="m_-4942221354445230965AppleMailSignature" class="gmail_msg">Sounds doable. Probably wouldn't need to go through evolution to get it too (but I'll let others make that call). Please file an SR about this too.<br class="gmail_msg"><br class="gmail_msg">~Robert Widmann</div><div class="gmail_msg"><br class="gmail_msg">2017/01/25 3:25、Dave Kliman via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>> のメッセージ:<br class="gmail_msg"><br class="gmail_msg"></div></div><div dir="auto" class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">Hi!<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I’m somewhat new to swift, so this issue may have been covered.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I really like how I get a warning for variables I’ve declared, but have not mutated, or constants that I did not read.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">What about warnings for anything not accessed outside its declared scope, encouraging the use of <i class="gmail_msg">private</i>, or <i class="gmail_msg">fileprivate</i> more often?</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">-Dave</div></div></blockquote><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><span class="gmail_msg">_______________________________________________</span><br class="gmail_msg"><span class="gmail_msg">swift-evolution mailing list</span><br class="gmail_msg"><span class="gmail_msg"><a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a></span><br class="gmail_msg"><span class="gmail_msg"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class="gmail_msg"></div></blockquote></div>_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</blockquote></div>