Duncan Murdoch <[EMAIL PROTECTED]> writes: > What S4 is missing is "encapsulation". Wikipedia's article on > object-oriented programming gives a good definition: > > "Encapsulation - Ensures that users of an object cannot change the > internal state of the object in unexpected ways; only the object's own > internal methods are allowed to access its state. Each object exposes an > interface that specifies how other objects may interact with it." > > Neither of these properties holds in S4.
I don't like the definition of encapsulation in the Wikipedia. If nothing else, I think the second part about objects exposing an interface specifying how to interact with them should come first --- and S4 provides that. In my experience, the ability to create "obvious" interfaces to classes is the important part of encapsulation. Python's object system, for example, does not (easily) provide protections against abuse, but other than some initial misgivings, I've not missed it. + seth ______________________________________________ R-devel@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-devel