[swift-evolution] [Discussion] A Problem With SE-0025?

Charlie Monroe charlie at charliemonroe.net
Thu Jun 16 00:02:43 CDT 2016


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 at 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 <cocoadev at charlessoft.com <mailto:cocoadev at charlessoft.com>> のメッセージ:
> 
>>> On Jun 15, 2016, at 11:04 PM, Charles Srstka via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at 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 at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160616/09cc2e8a/attachment.html>


More information about the swift-evolution mailing list