[swift-evolution] ability to derive a class from a struct or other value type

Mike Kluev mike.kluev at gmail.com
Wed Jun 21 13:29:53 CDT 2017

sorry if this was already discussed.

proposing an ability to derive a class from a struct or another value type
(e.g. enum).
would make it easy to wrap value type in a reference type without explicit

struct S {
    var v: Int
    func method() {}
    static staticMethod() {}

class C: S {
func otherMethod() {}
// ...

let c = C()

c.v = 1

shall work as if i had a struct variable and all struct functions
implemented in a class calling through that var:

pseudo code:

class C {

// auto generated internally:
    var `struct`: S

    func method() {
    static staticMethod() {

func otherMethod() {}

would also be nice to have ability to overload struct's methods:

class C: S {
    override func method() {

and have struct initializators inherited:

let c = C(struct initialization params)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170621/89af45c7/attachment.html>

More information about the swift-evolution mailing list