About class methods visibility (public/private)

Yukihiro M. [email protected] wrote:

(Unlike Java and such) visibility in Ruby are very trivial, so I don’t
want to make things more complex for the sake of visibility. I’d
rather remove them altogether unless compatibility problem arise.

If you don’t want to rename the 2 methods and if you can’t remove them
for compatibility reasons, you can at least make them deprecated.
This will be better for newcomers like me.

Yukihiro M. [email protected] wrote:

If you understand the current behavior of protected visibility, you
will understand why protected_class_method is not useful at all.
That’s why we don’t have it.

You’re absolutely right. You’re not Matz for nothing :slight_smile:

All classes are instances of the same class Class. Thus all classes have
access to protected class methods. Protected visibility has the same
behaviour as public visibility.

Correct me if I’m wrong.

On Mar 23, 10:27 am, Yukihiro M. [email protected] wrote:

(Unlike Java and such) visibility in Ruby are very trivial, so I don’t
want to make things more complex for the sake of visibility. I’d
rather remove them altogether unless compatibility problem arise.

Works for me. Although I don’t think the above statement itself is
complex. It’s pretty straightforward Ruby, sending a message to the
singleton.

|But if they’ve got to stay, please, at least consider renaming them
|something like class_public and class_private.

if public/private/protected are called without method names, it
switches the default visibility. public_class_method and such does
not this trick. Renaming public_class_method to class_public does not
sound right for me, since it strongly suggest the changing the
default.

I see.

T.