[swift-evolution] [Draft] A Consistent Foundation For Access Control: Scope-Bounded Capabilities

Adrian Zubarev adrian.zubarev at devandartist.com
Fri Mar 3 13:26:39 CST 2017

Can you check this translation, and maybe based on it’s (possible) mistakes provide better examples in the next proposal draft on how one should think with the new pure access model.

open class A {
    open internal(set) var abc: Int = 42

    public static func foo() {}

    open class func bar() {}

access(inherit, everywhere) class A {
    access(override, everywhere) access(set, submodule) var abc: Int = 42

    // implicit 'call'
    access(everywhere) access(override, nowhere) access(type) func foo() {}

    access(override, everywhere) access(type) func bar() {}

Adrian Zubarev
Sent with Airmail

Am 3. März 2017 um 20:12:28, Adrian Zubarev (adrian.zubarev at devandartist.com) schrieb:

If I understand the model correctly, then classes structs and enums will have an addition capability for their members.

static = access(type) access(override, nowhere)

class = access(type) access(override, everywhere)

You could combine type into one parameterized access, and make the capability instance the default one, so it will be either or but we don’t have to write instance explicitly like we don’t need it with get.

Adrian Zubarev
Sent with Airmail

Am 3. März 2017 um 19:36:31, Adrian Zubarev (adrian.zubarev at devandartist.com) schrieb:

I actually found the source, and it’s even an official one. :)



In a class declaration, the static keyword has the same effect as marking the declaration with both the class and final declaration modifiers.
It’s overlapping but you might be able to adjust the behavior to cover that in your model as well ;)

Adrian Zubarev
Sent with Airmail

Am 3. März 2017 um 18:14:42, Matthew Johnson (matthew at anandabits.com) schrieb:

It would be really helpful if you can find a reference to this somewhere.  If it’s possible to define static in terms of this system also that would be pretty cool.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170303/1dd55af6/attachment.html>

More information about the swift-evolution mailing list