[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: About class methods visibility (public/private

Yukihiro Matsumoto

3/23/2007 2:27:00 PM

Hi,

In message "Re: About class methods visibility (public/private)"
on Fri, 23 Mar 2007 18:34:22 +0900, "Trans" <transfire@gmail.com> writes:

|Ick! When did those get in there? I'm almost glad I never noticed
|before. Why bother? Just give us a method for singleton/eigenclass/
|metaclass whatever you want to call the "context" and allow:
|
| context.public :foo

(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.

|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.

matz.

1 Answer

Trans

3/24/2007 12:04:00 PM

0



On Mar 23, 10:27 am, Yukihiro Matsumoto <m...@ruby-lang.org> wrote:
> Hi,
>
> In message "Re: About class methods visibility (public/private)"
> on Fri, 23 Mar 2007 18:34:22 +0900, "Trans" <transf...@gmail.com> writes:
>
> |Ick! When did those get in there? I'm almost glad I never noticed
> |before. Why bother? Just give us a method for singleton/eigenclass/
> |metaclass whatever you want to call the "context" and allow:
> |
> | context.public :foo
>
> (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.