<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>I remain a fan of adding 'namespace' to the language.&nbsp;</div><div><br></div><div>In the meantime I'll continue using the enum static member approach. But I would love to have something semantically cleaner.&nbsp;</div><div><br>El ene. 30, 2017, a las 3:09 PM, Robert Widmann via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; escribió:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><div class="">I submitted a proposal with TJ a while ago that tried to address this comprehensively because the trouble is if you just want submodules you have to define how our current penta-scheme of access control interacts with each level or do away with a few of them to make some simplifying assumptions. &nbsp;It also raises an ambiguity with qualified imports that has to be worked out.</div><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 30, 2017, at 9:00 AM, Adrian Zubarev via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">If I remember correctly it has been said that we don't need namespaces in favor of submodules, which schould solve these issues.<br class=""> <br class=""><div class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px" class="">--&nbsp;<br class="">Adrian Zubarev<br class="">Sent with Airmail</div></div><p class="gmail_quote" style="">Am 30. Januar 2017 um 14:55:31, Tuur Anton via swift-evolution (<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>) schrieb:</p> <blockquote type="cite" class="gmail_quote"><span class=""><div class=""><div class=""></div><div class="">



<title class=""></title>


<div class="">The lack of namespaces is making people create all kinds of
"design patterns".<br class=""></div>
<div class=""><br class=""></div>
<div class="">struct API {</div>
<div class="">&nbsp; &nbsp; static let endpoint = "<a href="http://example.com/api" target="_blank" rel="noopener noreferrer" class="">http://example.com/api</a>"</div>
<div class="">}</div>
<div class=""><br class=""></div>
<div class="">Here is an "improvement" to the above "design pattern" to
prevent instantiating API:</div>
<div class=""><br class=""></div>
<div class="">struct API {</div>
<div class="">&nbsp; &nbsp; private init() {}</div>
<div class="">&nbsp; &nbsp; static let endpoint = "<a href="http://example.com/api" target="_blank" rel="noopener noreferrer" class="">http://example.com/api</a>"</div>
<div class="">}</div>
<div class=""><br class=""></div>
<div class="">Finally, here is another "improvement" that uses enum instead
of struct to avoid having to write the private initializer:</div>
<div class=""><br class=""></div>
<div class="">enum API {</div>
<div class="">&nbsp; &nbsp; static let endpoint = "<a href="http://example.com/api" target="_blank" rel="noopener noreferrer" class="">http://example.com/api</a>"</div>
<div class="">}</div>
<div class=""><br class=""></div>
<div class="">I doubt any of you find this beautiful. Yet these "design
patterns" (just hacks IMO) are spreading like the plague because of
the lack of namespaces.</div>
<div class=""><br class=""></div>
<div class="">What do you think?</div>
<div class=""><br class=""></div>


_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></div></span></blockquote></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>