I think this was the original intent of SE-0025, but it is subject to the issue 
I raised in the root: If the entire decl is declaration-private, then it cannot 
be constructed because its members are also declaration-private.  We can forbid 
it at the top level but that doesn't solve the problem for inner classes and 
we'd have to needlessly special-case the grammar.  We could solve it with a 
diagnostic for top-level declaration-private aggregates but is that really a 
good solution?   Then again, we could raise the access level of 
declaration-private members with no access modifier but then we'd break 
containment and we're back to square one because declaration-private now just 
effectively means fileprivate for this one huge use case.

~Robert Widmann

2016/06/15 22:02、Charlie Monroe <char...@charliemonroe.net> のメッセージ:

> Wouldn't this get solved by ditching fileprivate (which would be /is right 
> now/ the default behavior for private) and introduce a more private level 
> instead, e.g. "declaration" or "scope"
> 
> /// File A
> 
> public struct MyStruct {
>       declaration var x: Int
>       private var y: Int
>       internal var z: Int
> 
>       init() {
>               x = 0
>               y = 1
>               z = 2
>       }
> }
> 
> /// Within the same file
> let str = MyStruct()
> str.x // Error
> str.y // OK
> str.z // OK
> 
> /// File B
> 
> /// Another file
> let str = MyStruct()
> str.x // Error
> str.y // Error
> str.z // OK
> 
> I know that this goes in the other direction than the original proposal, but 
> it would solve all these issues, while fully preserving backward 
> compatibility. Am I missing something?
> 
> 
>> On Jun 16, 2016, at 6:30 AM, Robert Widmann via swift-evolution 
>> <swift-evolution@swift.org> wrote:
>> 
>> Yes, we agree.  Can we please discuss what to do about SE-0025?
>> 
>> ~Robert Widmann
>> 
>> 2016/06/15 21:18、Charles Srstka <cocoa...@charlessoft.com> のメッセージ:
>> 
>>>> On Jun 15, 2016, at 11:04 PM, Charles Srstka via swift-evolution 
>>>> <swift-evolution@swift.org> wrote:
>>>> 
>>>> Result is that the property is only accessible from inside its parent type.
>>> 
>>> *inside the type’s parent type
>>> 
>>> Charles
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution@swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> 
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to