[swift-evolution] [Proposal][Discussion] Modular Swift
devteam.codafi at gmail.com
Tue Feb 21 01:26:51 CST 2017
2017/02/21 2:16、Jonathan Hull <jhull at gbis.com> のメッセージ:
> It is how it interacts with our current access control. The scope based nature of this will conflict with the file based nature of the stuff left from Swift 2. I am convinced we need to overhaul it in one sweep to fit one metaphor or the other. The more we mix them, the harder it is to wrap your head around. We can’t keep rehashing it every 6 months, but that is what will happen so long as it stays in this confused state.
How does this conflict? Moreover, what do you feel we are adding here that crosses the line?
This is not a rehash of existing concepts. We do not deprecate the access control scheme, and we don't extend it except to define how symbols can indicate they wish to cross/not cross the module boundary. This is genuinely a system to enable modularity at as little cost as we could suss out given inspiration from other programming languages.
tl;dr I don't want to confuse this with the fileprivate debate. It is possible to have physical access control and modularity, they're not mutually exclusive. And the existing access control scheme cannot express the same concepts a real module system can, so it's not enough to paint this as a syntactic/physical argument.
> I think I would prefer overall trying swift’s file based system because I think we can completely close that with only 1-2 additional concepts (and it would stay conceptually simple). I would also be fine with switching to a purely type/scope based system with protected, etc…, but I feel like that will need more complexity to get it fully working (e.g. friends), and will end up being a more complex system overall.
The semantics we intend are all there in the proposal. You can see for yourself just how much this will complect the language versus a different proposal to redo access entirely.
>>> On Feb 20, 2017, at 11:03 PM, Robert Widmann <devteam.codafi at gmail.com> wrote:
>>>> On Feb 21, 2017, at 2:01 AM, Jonathan Hull <jhull at gbis.com> wrote:
>>>> On Feb 20, 2017, at 10:46 PM, Robert Widmann via swift-evolution <swift-evolution at swift.org> wrote:
>>>> More generally, we need to move access control away as far away from filesystems as possible. One day, the compiler is going to get ported over to a platform with some bonkers rules that are going to turn around and bite us.
>>> This is the key thing which I think is being debated right now. Swift 2 defined the file as a unit of compilation and based its elegant system of access modifiers on that. With Swift 3 we have a mix of type/scope based modifiers and file based modifiers… and it is super confusing to everyone because we have mixed our metaphors.
>>> As much as I want modules, I am now convinced that this proposal will only make that situation worse. We need to pick one way (file based) or the other (scope based) and commit to it… but either way, it will require a larger overhaul to make the system consistent/usable/teachable again.
>>> As an analogy, it is like some people are trying to play rock music during a classical music concert. Both are great independently, and different people may prefer one or the other… but trying to play them on top of one another just results in noise.
>> Is there anything specifically about this proposal that turns you off, or is it access control as it stands today?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution