> On Oct 12, 2016, at 4:48 PM, Charles Srstka via swift-evolution 
> <[email protected]> wrote:
> 
> Since the definitions of the properties are implementation details, the 
> generated interface would collapse to the simple list of cases and their 
> associated values, just as methods, dynamic properties, etc. currently do.

I misspoke here; I meant to say that the *implementations* of the properties 
are implementation details. I.e. just as this:

struct MyStruct {
    var foo: String {
        return "Foo"
    }
    
    var bar: String {
        return "Bar"
    }
}

reduces to this:

internal struct MyStruct {

    internal var foo: String { get }

    internal var bar: String { get }
}

an enum declared like this:

enum MyEnum {
    var desc: String { get }
    
    case foo {
        desc = "Foo"
    }
    
    case bar {
        desc = "Bar"
    }
}

would reduce to this:


enum MyEnum {
    var desc: String { get }
    
    case foo
    case bar
}

The promise is that there will be a property named “desc” and that it will get 
you a string; that’s all that’s important to the interface.

Charles

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to