ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: shevegen@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:81320] [Ruby trunk Feature#13551] Add a method to alias class methods
Date: Sun, 21 May 2017 17:33:39 +0000	[thread overview]
Message-ID: <redmine.journal-65007.20170521173338.f27273a733b5a64c@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-13551.20170509042019@ruby-lang.org

Issue #13551 has been updated by shevegen (Robert A. Heiler).


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.

I understand that the ruby team wants to be conservative and not
proliferate with lots of extra methods that have only a special
case (say active* gems), but to me I also completely understand
Joshua Stowers here - if possible it is MUCH, much better when
it would be in main ruby. So that everyone could use it.

- I may use it if it is in ruby core/stdlib.
- I may use duck patching (sometimes people use the monkey rather
than the duck) for my local code.
- But it is VERY unlikely that I would modify a core class of
ruby like this AND distribute my code to other people too. I
just consider it too cumbersome (and refinements, while the
idea is ok, I never really liked the syntax... and it felt
awkward... but this is for another discussion, lots of time
towards ruby 3.x I hope).

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

* Author: JustJosh (Joshua Stowers)
* Status: Feedback
* 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/

  parent reply	other threads:[~2017-05-21 16:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-13551.20170509042019@ruby-lang.org>
2017-05-09  4:20 ` [ruby-core:81046] [Ruby trunk Bug#13551] Add a method to alias class methods stowers.joshua
2017-05-09  7:09 ` [ruby-core:81056] [Ruby trunk Feature#13551][Feedback] " duerst
2017-05-09  7:19 ` [ruby-core:81058] [Ruby trunk Feature#13551] " matthew
2017-05-09 16:23 ` [ruby-core:81077] " stowers.joshua
2017-05-10  7:43 ` [ruby-core:81086] " duerst
2017-05-21 17:29 ` [ruby-core:81319] " shevegen
2017-05-21 17:33 ` shevegen [this message]
2017-06-14  3:07 ` [ruby-core:81676] " stowers.joshua
2017-06-14  3:08 ` [ruby-core:81677] " stowers.joshua
2017-09-25  8:13 ` [ruby-core:82973] [Ruby trunk Feature#13551][Rejected] " matz
2017-09-25  9:01 ` [ruby-core:82982] [Ruby trunk Feature#13551] " duerst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-65007.20170521173338.f27273a733b5a64c@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).