<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=""><div class="">Hi, Kévin. This sort of post is more appropriate for the swift-evolution list, and indeed there's already a bit of discussion around this. I suggest you <a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151207/thread.html" class="">look through the archives</a> to see what you need to add.</div><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 10, 2015, at 1:07, Kévin Machado via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><span class=""><div style="font-size:13px" class=""><span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class="">Dear colleagues,</span></div><div style="font-size:13px" class=""><span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class=""><br class=""></span></div><div style="font-size:13px" class=""><span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class="">In swift we are able to add</span><span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class=""> </span><code style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:14px;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" class="">extension</code><span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class=""> </span><span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class="">of classes that allows us to add methods but we cannot add attributes, properties. </span><code style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:14px;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" class="">C# language</code><span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class=""> </span><span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class="">allows developers to make its</span><span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class=""> </span><em style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class="">classes </em><span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class="">partial</span><em style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class="">. It is possible to split the definition of class, struct or interface over two or more source files</em><span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class="">.</span></div><div style="font-size:13px" class=""><span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class=""><br class=""></span></div><div style="font-size:13px" class=""><span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class="">Could we make swift able to do this stuff ?</span></div><div style="font-size:13px" class=""><span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class=""><b class="">Are you interested about this kind of feature ?</b></span><div class=""><h2 style="margin-top:1em;margin-bottom:16px;line-height:1.225;font-size:1.75em;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'" class="">Proposed solution</h2><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class="">Add <code style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:14px;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" class="">partial</code> keyword to alert the compiler that this class is splited over one or more source files.</p><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class=""><strong class="">Example</strong></p><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px" class=""><pre style="overflow:auto;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:14px;margin-top:0px;margin-bottom:0px;line-height:1.45;padding:16px;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal;word-break:normal" class=""> <span style="color:rgb(150,152,150)" class="">// Common logic for bank model</span>
partial <span style="color:rgb(167,29,93)" class="">class</span> Bank {
<span style="color:rgb(167,29,93)" class="">var</span> amount: <span style="color:rgb(0,134,179)" class="">Int</span>
<span style="color:rgb(167,29,93)" class="">init</span>() {
amount <span style="color:rgb(167,29,93)" class="">=</span> <span style="color:rgb(0,134,179)" class="">0</span>
<span style="color:rgb(167,29,93)" class="">super</span><span style="color:rgb(167,29,93)" class="">.</span><span style="color:rgb(167,29,93)" class="">init</span>()
}
<span style="color:rgb(167,29,93)" class="">func</span> <span style="color:rgb(121,93,163)" class="">withdraw</span>(amount amount: <span style="color:rgb(0,134,179)" class="">Int</span>) {
<span style="color:rgb(167,29,93)" class="">self</span><span style="color:rgb(167,29,93)" class="">.</span>amount <span style="color:rgb(167,29,93)" class="">-=</span> amount
}
}
<span style="color:rgb(150,152,150)" class="">// Business logic for customer within bank model</span>
partial <span style="color:rgb(167,29,93)" class="">class</span> Bank {
<span style="color:rgb(167,29,93)" class="">unowned</span> <span style="color:rgb(167,29,93)" class="">let</span> owner: Customer
<span style="color:rgb(167,29,93)" class="">init</span>(customer: Customer) {
<span style="color:rgb(167,29,93)" class="">self</span><span style="color:rgb(167,29,93)" class="">.</span><span style="color:rgb(0,134,179)" class="">owner</span> <span style="color:rgb(167,29,93)" class="">=</span> customer
}
<span style="color:rgb(167,29,93)" class="">func</span> <span style="color:rgb(121,93,163)" class="">notifyCustomer</span>() {
<span style="color:rgb(150,152,150)" class="">// some code</span>
}
}</pre></div><h2 style="margin-top:1em;margin-bottom:16px;line-height:1.225;font-size:1.75em;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'" class=""><a href="https://github.com/djnivek/swift-evolution/blob/56929274a31ff58295841a74a1eb2ace9db3e428/proposals/0008-makes-swift-class-struct-definitions-partial.md#alternative-solution" target="_blank" style="color:rgb(64,120,192);background-color:transparent;text-decoration:none;display:inline-block;padding-right:2px;line-height:1" class=""><span style="font-weight: normal; font-size: 16px; line-height: 1; font-family: octicons; display: inline-block; vertical-align: middle;" class=""></span></a>Alternative solution</h2><div style="margin-top: 0px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; margin-bottom: 0px !important;" class="">We also could add more feature with the <code style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:14px;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" class="">extension</code> paradigm. Adding properties, attributes and more directly on the <em class="">extension scope</em>.</div></div></div></span><br class=""></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=ZEz4qHYnXhPr3bBPu-2FxP4tN3HfWKL-2FtJpqkQ0gkOVSCpQzMCKCnJOEIP2BitCIrLM41KyLAkEe5mesr3Lu4SCEK7dJFGGi7lSRTSCrVKcC0ySFAbtxBwDn1K-2Bipysck2MW35XwuXvrWoioR9c0ACC1uc40ILABUedyurC9u7r7ExirV9bs2tQ0o37bCOW7hFW0D52gFnG1SAKSjUDQi5Uo2haX9GSPufXdDH22EI-2Bl8-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-dev<br class=""></div></blockquote></div><br class=""></body></html>