5 ms·
It seems that they have chosen a default (internal, though I don't know how to interpret how "most of the time" works) which is similar to the default modifier
by Dewie 12y ago
It seems that they have chosen a default (internal, though I don't know how to interpret how "most of the time" works) which is similar to the default modifier in Java. It seems, though, that java's default modifier was maybe ill-chosen, as private and public modifiers seem far more prevalent than no modifier (which means that the default modifier is used) in java code.
- millerm 12y agoIt's like "protected" access, in Java's terms. Subclasses can't access the default members in Java. That is why it is so rarely used. It was oddly restrictive, and didn't seem like it made much sense in most cases. I don't find this as a bad decision, in Swift. Since you don't normally want to expose the internals of your classes, this was a good choice. http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html http://docs.oracle.com/javase/tutorial/java/javaOO/accesscon...
- hammerdr 12y agoI think you might have gotten it wrong? I think it (Swift's internal/default) is more like "package-private" in Java. It looks almost exactly like C#'s internal: http://msdn.microsoft.com/en-us/library/ms173121.aspx http://msdn.microsoft.com/en-us/library/ms173121.aspx
- masters3d 12y agoChrisLattner talks about the java in this recent post if you have access to the apple dev site. https://devforums.apple.com/message/1010693#1010693 https://devforums.apple.com/message/1010693#1010693 …
- rsynnott 12y ago> It seems, though, that java's default modifier was maybe ill-chosen, as private and public modifiers seem far more prevalent than no modifier My impression is that people often simply don't know exactly what the default modifier does, whereas they're more confident in the behaviour of public and private.