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

David Waite david at alkaline-solutions.com
Mon Mar 28 16:23:55 CDT 2016


> On Mar 28, 2016, at 2:30 PM, Jordan Rose via swift-evolution <swift-evolution at swift.org> wrote:
> 
> P.S. Extensions do make things a little more complicated, but again, there's almost no precedent here, and pretty much everyone agrees that this new scope-private access level shouldn't give access to extensions. That also means there's an option to keep yourself from accidentally accessing scope-private members in a member type: put the member type in an extension.

The only example that comes to mind is Ruby, where I can add new methods to an existing class, and those new methods indeed have access to existing ‘private’ methods:

class A
  private def foo()
    puts “foo called”
  end
end

A.new.foo() # error

class A
  def bar() # add new bar method
    foo()
  end
end

A.new.bar() # prints “foo called”

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160328/bda73bb9/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160328/bda73bb9/attachment.sig>


More information about the swift-evolution mailing list