Issue #2170 has been updated by Run Paint Run Run.


> I'm trying to see how that could be useful, to understand your goal.

A method's visibility is one of its attributes. The Method class objectifies methods, so it is expected that it provides access to the wrapped method's attributes. This abstraction is broken when you must retrieve the Method's name, then pass it to another class to determine such an attribute. 

If you're using Method objects to obtain the source code of a method it is probable that you're producing documentation or performing static analysis, both of which would likely at least benefit from visibility metadata. If you're using Method objects to copy methods to other classes or objects, such as with define_method, it is probable that you want to reinstate the method with its original visibility. Indeed, most examples of using Method objects that come to mind would be bolstered by this data.

> Moreover I see problems with defining it. The original method could have changed of 
> accessibility or no longer exist. method#private? returns the accessibility at the moment 
> the Method was created, which seems even less useful. 

It could have changed its arity or source, too, depending on how you're defining "original method". A Method object represents the method at the point it was objectified.

> Similarly, results with aliases can be counterintuive.

It would be surprising if a "naïve", proof-of-concept patch on a codebase with which I'm unfamiliar was perfect. I don't see how aliases are a conceptual problem.

Anyway, it was but a suggestion; if it lacks general utility then by all means close the ticket.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/2170

----------------------------------------
http://redmine.ruby-lang.org