<div dir="ltr">"C() is S" shall be false, and you won't be able passing C where S is required.<div><br></div><div>you will be able passing c.`struct` though (or some better equivalent name).<div>passing c.`struct` would be no different than it is now should you implement this class manually with explicitly defined var for S.<br><div><div><br></div><div><span style="font-size:12.800000190734863px">Mike</span></div><div><span style="font-size:12.800000190734863px"><br></span></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 21 June 2017 at 22:08, Charlie Monroe <span dir="ltr"><<a href="mailto:charlie@charliemonroe.net" target="_blank">charlie@charliemonroe.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">What happens when you pass C somewhere where S is required? Is that an error?<br>
<br>
C() is S // Is this true or false?<br>
<br>
<br>
If it's true, then you can pass a mutable instance somewhere let is used, if it's false, then it is really confusing...<br>
<div><div class="h5"><br>
<br>
> On Jun 21, 2017, at 8:29 PM, Mike Kluev via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
><br>
> sorry if this was already discussed.<br>
><br>
> proposing an ability to derive a class from a struct or another value type (e.g. enum).<br>
> would make it easy to wrap value type in a reference type without explicit code:<br>
><br>
> struct S {<br>
> var v: Int<br>
> func method() {}<br>
> static staticMethod() {}<br>
> }<br>
><br>
> class C: S {<br>
> func otherMethod() {}<br>
> // ...<br>
> }<br>
><br>
> let c = C()<br>
><br>
> c.v = 1<br>
> c.method()<br>
> C.staticMethod()<br>
> c.otherMethod()<br>
><br>
> shall work as if i had a struct variable and all struct functions implemented in a class calling through that var:<br>
><br>
> pseudo code:<br>
><br>
> class C {<br>
><br>
> // auto generated internally:<br>
> var `struct`: S<br>
><br>
> func method() {<br>
> `struct`.method()<br>
> }<br>
> static staticMethod() {<br>
> S.staticMethod()<br>
> }<br>
> //---<br>
><br>
> func otherMethod() {}<br>
> }<br>
><br>
> would also be nice to have ability to overload struct's methods:<br>
><br>
> class C: S {<br>
> override func method() {<br>
> super.method()<br>
> }<br>
> }<br>
><br>
> and have struct initializators inherited:<br>
><br>
> let c = C(struct initialization params)<br>
><br>
> thoughts?<br>
><br>
> Mike<br>
><br>
</div></div>> ______________________________<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>