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

Nevin Brackett-Rozinsky nevin.brackettrozinsky at gmail.com
Thu Mar 2 15:42:06 CST 2017


This is an intriguing proposal. There are parts I like, and parts that I
will have to think about more before drawing an opinion.

Personally, I would like to see public classes be inheritable, public
protocols be conformable, and public enums be switchable, unless specified
otherwise. However I will defer to those who have more experience writing
libraries.

On a first read-through, a few things stand out to me:

1. There are still five basic access levels: scope, private, internal,
public, and open. I think this is too many, and would prefer to just have
private, internal, and public.

2. The default is listed as “submodule”. I think the default should always
be “module”, and restriction to a submodule should be explicit.

3. There is still a file-specific access level. I think this should be
removed in favor of the submodule level. If submodules can be nested then
there is no loss of expressivity, because a file could be made its own
sub-submodule.

4. The proposal keeps a scope-based access level, which I think is
unnecessary.

All that said, there is a lot to like about this model, and I will let the
ideas percolate.

Nevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170302/3593969b/attachment.html>


More information about the swift-evolution mailing list