ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:102884] [Ruby master Bug#17725] Prepend Breaks Ability to Alias
@ 2021-03-16 17:26 josh
  2021-03-16 17:34 ` [ruby-core:102885] " josh
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: josh @ 2021-03-16 17:26 UTC (permalink / raw)
  To: ruby-core

Issue #17725 has been reported by joshuadreed (Josh Reed).

----------------------------------------
Bug #17725: Prepend Breaks Ability to Alias
https://bugs.ruby-lang.org/issues/17725

* Author: joshuadreed (Josh Reed)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Prepending any module to `String` and `Hash` (and possibly other or all classes?) blocks the ability to `alias` 

As an example:
``` ruby
module Dummy; end
# String.prepend(Dummy)
class String
  alias_method(:old_plus, :+)
  def + other
    puts 'blah blah'
    old_plus(other)
  end
end

'a' + 'b'

> blah blah
```

``` ruby
module Dummy; end
String.prepend(Dummy)
class String
  alias_method(:old_plus, :+)
  def + other
    puts 'blah blah'
    old_plus(other)
  end
end

'a' + 'b'

>
```

Prepending after an `alias` does not affect the previous `alias`



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

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-12-24  9:05 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16 17:26 [ruby-core:102884] [Ruby master Bug#17725] Prepend Breaks Ability to Alias josh
2021-03-16 17:34 ` [ruby-core:102885] " josh
2021-03-16 18:15 ` [ruby-core:102886] " josh
2021-03-16 18:47 ` [ruby-core:102887] " josh
2021-03-17  1:09 ` [ruby-core:102895] [Ruby master Bug#17725] Prepend breaks ability to override optimized methods nobu
2021-03-17  1:15 ` [ruby-core:102896] " nobu
2021-03-17  1:24 ` [ruby-core:102897] " nobu
2021-03-18  4:35 ` [ruby-core:102911] " xtkoba+ruby
2021-03-20  6:42 ` [ruby-core:102951] " xtkoba+ruby
2021-04-09 22:10 ` [ruby-core:103358] " merch-redmine
2021-08-01  9:27 ` [ruby-core:104738] " nagachika00
2021-11-24 15:04 ` [ruby-core:106266] " mk
2021-12-24  5:54 ` [ruby-core:106801] " nagachika (Tomoyuki Chikanaga)
2021-12-24  9:05 ` [ruby-core:106805] " nagachika (Tomoyuki Chikanaga)

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