[#61424] [REJECT?] xmalloc/xfree: reduce atomic ops w/ thread-locals — Eric Wong <normalperson@...>

I'm unsure about this. I _hate_ the extra branches this adds;

13 messages 2014/03/12

[ruby-core:61267] [ruby-trunk - Bug #9581] `=~` defined on a subclass of `String` is sometimes ignored, and `String#=~` is called instead

From: normalperson@...
Date: 2014-03-03 21:12:28 UTC
List: ruby-core #61267
Issue #9581 has been updated by Eric Wong.


 Thanks both, I will commit the following once others have reviewed:
 http://bogomips.org/ruby.git/patch?id=fbd3769851f
 (git://80x24.org/ruby.git bug9581)

----------------------------------------
Bug #9581: `=~` defined on a subclass of `String` is sometimes ignored, and `String#=~` is called instead
https://bugs.ruby-lang.org/issues/9581#change-45604

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: 2.1.0p0
* Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
As is reported on StackOverflow (http://stackoverflow.com/questions/22103018) by Gabriel, overridden `=~` on a subclass of `String` is sometimes ignored, and the original `String#=~` is called. Particularly, when we have:

    class MyString < String
      def =~ re; :foo end
    end
    s = MyString.new("abc")

these give the correct result:

    r = /abc/; s =~ r   # => :foo
    s.send(:=~, r)      # => :foo
    s.send(:=~, /abc/)  # => :foo

but in this case, `MyString#=~` is ignored, and `String#=~` is called instead:

    s =~ /abc/          # => 0
    



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

In This Thread

Prev Next