> On Mar 28, 2016, at 14:23, David Waite <[email protected]> wrote:
> 
> 
>> On Mar 28, 2016, at 2:30 PM, Jordan Rose via swift-evolution 
>> <[email protected] <mailto:[email protected]>> 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”

Yeah, I tried to sweep that under the rug by noting that Ruby's definition of 
"private" didn't match up with either Java-private or current-Swift-private 
anyway, but it's true that someone coming from Ruby might expect this to work.

Jordan

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

Reply via email to