next up previous
Next: 5 Abstract classes Up: Differences between Sather-1.0 and Previous: 3 Determinism

4 Encapsulation

 

There are two major differences of interpretation of encapsulation between SK and S1.

S1 interprets tex2html_wrap_inline390 per-class; that is, code may invoke a private method on another object of the same class. SK interprets tex2html_wrap_inline390 per-object; it is not legal to dot into private methods. In SK private methods may only be called implicitly on tex2html_wrap_inline394 . In this sense, SK has a stronger notion of privacy than S1.

S1 requires that the creation and initialization of an object execute code in the object's class, and that access to private attributes by code outside of the class be strictly impossible, even by pickling - converting entire data structures to and from a common format for persistence or debugging. In this sense, S1 has a stronger notion of privacy than SK.

The implications of these differences are far-reaching:

Observation for S2: a compromise that would allow the per-object privacy of SK with the simplicity and encapsulation of S1 would be to somehow distinguish special methods such as tex2html_wrap_inline412 which would automatically have a new object as tex2html_wrap_inline394 .