On Fri, Mar 14, 2003 at 06:23:35AM +0900, Han Holl wrote:
> Concrete question: there are a couple of helper classes and
> modules, that should be as invisible as possible. Hoe does one go
> about that? In C++ I would make a lot of stuff private, and declare
> a bunch of friends, but Ruby doesn't support those concepts.

As long as they are created within a module, and therefore aren't polluting
anybody's namespace, I wouldn't worry about it. In previous discussions on
this topic I think the majority view was that if someone wants to go through
your source and start using the internals, then the risk is on them.

Using 'protected' and a common base class, you can hide methods (but not
classes/modules).

I would have thought you could set 'protected_class_method :new' to stop
people creating instances, but this does not seem to exist in 1.6.8. Is
there an underlying reason for this?

Regards,

Brian.