[swift-evolution] access control

Rob Mayoff mayoff at dqd.com
Mon Jan 25 22:40:26 CST 2016


On Mon, Jan 25, 2016 at 10:37 PM, Nate Birkholz via swift-evolution <
swift-evolution at swift.org> wrote:
>> Note that moving a private class to its own file to make its privates
more private does not work. Now I have to make the formerly-private class
an internal class, so I'm not sending the first message anymore.
>
> Why do you have to make it internal then? I'm confused.

In Scheduler.swift, I have public (or internal) class Scheduler, and it
uses private class JobRecord, also in Scheduler.swift.

I want to make some of JobRecord's members private to JobRecord. Right now,
the only way to do that is to move JobRecord to a separate file, say
JobRecord.swift, so that its privates become "more private" (since class
JobRecord is the only thing in JobRecord.swift).

But in order for JobRecord to be visible to Scheduler, I now have to change
"private class JobRecord" to "internal class JobRecord". The
message-to-future-Rob that JobRecord is only intended for use by
Scheduler.swift is lost (or at any rate its accuracy is no longer enforced
by the compiler).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160125/7529388a/attachment.html>


More information about the swift-evolution mailing list