[swift-evolution] Swift evolution proposal: introduce typeprivate access control level
Gonçalo Alvarez Peixoto
goncalo.alvarezpeixoto at gmail.com
Thu Dec 1 15:54:52 CST 2016
@Brandon
*Is anyone starting to think the current access control model will become
more burdensome over time?*
*People will want to add and subtract to it for years to come...which tells
me it's not very flexible. I'm beginning to feel like it is an old style
model trying to fit into a modern language. *
.Most definitely. We've mentioned earlier in this thread the usage of file
private feels somehow we're basing swift design on compiler related
constructs.
*For example, fileprivate and private encourage stuffing a lot of code into
one file just to use that access control level. If you want to break this
into more manageable chunks you have to make it internal or move it into a
new module which is very complicated to do in Xcode (I.e requiring a new
target like a framework). *
*.*Agreed. As stated before, this might lead into some kind of pattern
where types are chunked into the same file for the sakes of member access
convenience. I strongly believe we should aim at promoting code clarity and
readability while enhancing single responsibility principle's good
practices.
*This keeps leading me back to having submodules or creating modules on
demand. I think that would open up this system to great complexity.*
*Want to keep something private to a specific class but private to anything
outside of it? Make it internal to the same "submodule". *
*I think we could keep tacking on things to access control, but I don't
think it is really solving everyone's needs. I think a more flexible system
would allow people to adapt it to their needs instead of structuring
everything around a rigid system that forces you to do it swift's way. *
Don't you feel that would defeat the purpose of access control levels?
Correct if I'm wrong, but I don't think there's much to gain from trying to
dodge the need for private (whether scope private, fileprivate or
eventually typeprivate) members no matter how modularised your code is.
Also, I believe it an unworthy effort, as I think we could run the risk of
creating problems further in the chain of access control levels? I just
think we'd be pushing the problem further up the hill.
Best,
Gonçalo
2016-12-01 20:40 GMT+00:00 Brandon Knope <bknope at me.com>:
>
>
> > This keeps leading me back to having submodules or creating modules on
> demand. I think that would open up this system to great complexity.
>
> I meant "flexibility"...not complexity. Freudian slip? 😂
>
> Brandon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161201/9cfc0053/attachment.html>
More information about the swift-evolution
mailing list