<div dir="ltr">Isn't the general solution to this problem submodules? In any case, seems like it'd be out of scope for Swift 4 phase 1.<div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 9, 2016 at 11:34 AM, Adrian Zubarev via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>There must be a better solution to this problem, because you might also extend value types from different files. That would mean, we'd need `structprivate` `protocolprivate` etc.<div><br></div><div>How about: `internal(class)` etc. ? Or something like `internal(private)` to rule them all (I don't like the last name, but something that would rule them all would be nice to have)!</div><div><br> <br><div><div style="font-family:helvetica,arial;font-size:13px">-- <br>Adrian Zubarev<br>Sent with Airmail</div></div><div><div class="h5"> <p class="gmail_quote" style="color:#000">Am 9. September 2016 um 17:49:29, Tom Bates via swift-evolution (<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>) schrieb:</p> </div></div><blockquote type="cite" class="gmail_quote"><span><div><div></div><div><div><div class="h5">
<div dir="ltr">
<div><span style="line-height:1.5">There is currently no way of
accessing "shared code" from extensions declared outside the base
.swift file</span><br></div>
<div><br></div>
<div>I would love to see along side the new fileprivate access
level a classprivate access level that would allow any extension
declared outside of the original .swift file to access these
properties and functions in an attempt to reuse code.</div>
<div><br></div>
an example is below...<br>
<br>
=================<br>
//MyClass.swift<br>
public class MyClass {<br>
<br>
classprivate func sharedFunction() {<br>
self.function1()<br>
self.function2()<br>
}<br>
<br>
fileprivate func function1() {}<br>
fileprivate func function2() {}<br>
}<br>
=================<br>
<br>
<div>=================<br>
<div>//MyClass+Save.swift<br>
extension MyClass {<br>
<br>
public func save() {<br>
self.someFunction()<br>
self.sharedFunction()<br>
}<br>
<br>
fileprivate func someFunction() {}<br>
}
<div>=================<br></div>
<div><br></div>
<div>Currently to achieve anything like this you would have to make
the "core" functions public or internal or write the whole thing in
a single file which as I understand it is not optimal for the
compile speed and can get unmanageable for large classes. This
would allow a more managed file structure and the separation of
related functions from the core declaration.</div>
<div><br></div>
<div>There would be no migration needed I don't think as the impact
on current code would be zero until the developer adopts the new
access level</div>
<div><br></div>
<div>Regards,</div>
<div>Tom</div>
</div>
</div>
</div></div></div>
______________________________<wbr>_________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br></div></div></span></blockquote>
</div></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>