I've been waiting so long for this. Now with Scala you can restrict access to your classes by package name, allowing only a package and its nested packages access. Say you had the packages,
Then the access modifiercom.controlcom.control.agentcom.control.agent.special
private[agent] would limit access to the last two packages only.You can also define members as object-private with the access modifier
private[this]. This restricts access to the specific instance. In Java, other instances of the same class can access private fields. Did you realize that?What a wonderful cone of silence!


No comments:
Post a Comment