Issue #13551 has been updated by duerst (Martin Drst).


shevegen (Robert A. Heiler) wrote:
> Martin showed this example:
> 
> > class Array
> >   class << self
> >     alias :my_new :new
> >   end
> 
> Ruby allows this flexibility, this is true. This is also great, we
> love it.
> 
> But when you use this code and want to distribute it, it is more
> cumbersome. And not everyone likes to have modifications that
> are non-standard ruby in their code.

Sorry, I should have used another example than Array. This issue is about aliasing class methods, and aliasing a method in a builtin class would be a problem whether it's done with a new feature or with the way I showed. So the fact that I used Array is confusing, but orthogonal to the issue at hand.


----------------------------------------
Feature #13551: Add a method to alias class methods
https://bugs.ruby-lang.org/issues/13551#change-66890

* Author: JustJosh (Joshua Stowers)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
There doesn't seem to be an intuitive way to alias class methods.

Perhaps we can add a method such as 

~~~ ruby
alias_class_method :new_name, :old_name
~~~



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>