<div dir="ltr">On Tue, Feb 21, 2017 at 8:51 PM, Robert Widmann via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Feb 21, 2017, at 9:49 PM, Brent Royal-Gordon <<a href="mailto:brent@architechies.com" target="_blank">brent@architechies.com</a>> wrote:</div><br class="m_-8510041240524821623Apple-interchange-newline"><div><div><blockquote type="cite">On Feb 21, 2017, at 6:43 PM, Robert Widmann <<a href="mailto:devteam.codafi@gmail.com" target="_blank">devteam.codafi@gmail.com</a>> wrote:<br><br>That is not what this proposal requires. A public API is ripe for re(export), but if the parent wishes to communicate with its children without exporting across the module boundary, see the definition of `internal`.<br></blockquote><br>I'm not sure whether I'm misunderstanding or we're talking past each other.<br><br>Let me state this really simply. You have some code in a top-level module, `MyMod`:<br><br><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span>import MyMod.Submodule<br><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span><br><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span>func foo() {<br><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span>bar()<br><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span>}<br><br>And you have some other code in a submodule:<br><br><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span>module Submodule {<br><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span>??? func bar() {<br><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span>baz()<br><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span>}<br><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span>}<br><br>And then—perhaps in a separate file—you have some other code in an extension of the submodule:<br><br><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span>extension Submodule {<span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span><br><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span>??? func baz() {<br><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span>…<br><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span>}<br><span class="m_-8510041240524821623Apple-tab-span" style="white-space:pre-wrap">        </span>}<br><br>What access modifiers do I put on `bar()` and `baz()` so that `MyMod` can access `bar()` but not `baz()`, and code outside `MyMod` can access neither `bar()` nor `baz()`?<br><br></div></div></blockquote><div><br></div></span><div>internal</div></div></div></blockquote><div><br></div><div>Huh? Brent wants `bar()` to be visible inside `foo()`, but not `baz()`. How can they both use `internal`?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span class=""><div><br></div><div><ul style="box-sizing:border-box;padding-left:2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)"><li style="box-sizing:border-box"><code style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">open</code> and <code style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">public</code> declarations are exported by a module for consumption by clients of the module.</li></ul></div></span><div><span class=""><ul style="box-sizing:border-box;padding-left:2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)"><li style="box-sizing:border-box;margin-top:0.25em"><code style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">internal</code> declarations scope over the entire module and any derived submodules.</li></ul></span><div>This way you can consume your own interface without it crossing the module boundary.</div></div><span class="HOEnZb"><font color="#888888"><br><blockquote type="cite"><div><div>-- <br>Brent Royal-Gordon<br>Architechies<br><br></div></div></blockquote></font></span></div><br></div><br>______________________________<wbr>_________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br></blockquote></div><br></div></div>