[swift-evolution] SE-0025: Scoped Access Level, next steps

Tino Heth 2th at gmx.de
Wed Mar 16 11:37:01 CDT 2016


Just had an idea for a different approach for access levels (as if things aren't complicated enough ;-) - but I'm only brainstorming here):
The problem of access levels isn't limited to programming — file systems have to deal with it as well.
So, ignoring ACLs for a moment, imagine

protected x: Int
protected(set) public y: Int

would be expressed as

module(read, write) x: Int
public(read) y: Int

As far as I can see, this syntax is less convenient, but could allow things like "public(override)" to express that a method can't be called outside the module, but still can be overridden by subclasses.
Any thoughts on this?

Tino


More information about the swift-evolution mailing list