[#41916] Proposal: Bitmap Marking GC — Narihiro Nakamura <authornari@...>

Hi.

18 messages 2012/01/05

[#41941] [ruby-trunk - Bug #5851][Open] make check fails when compiling with GCC 4.7 - *** longjmp causes uninitialized stack frame *** — Vit Ondruch <v.ondruch@...>

12 messages 2012/01/06

[#41979] [ruby-trunk - Bug #5865][Open] Exception#== should return false if the classes differ — Hiro Asari <asari.ruby@...>

10 messages 2012/01/08

[#42003] [ruby-trunk - Bug #5871][Open] regexp \W matches some word characters when inside a case-insensitive character class — Gareth Adams <gareth@...>

14 messages 2012/01/09

[#42016] [ruby-trunk - Feature #5873][Open] Adopt FFI over DL — Heesob Park <phasis@...>

15 messages 2012/01/10

[#42149] [ruby-trunk - Feature #5899][Open] chaining comparsions. — Ondrej Bilka <neleai@...>

12 messages 2012/01/16

[#42164] [ruby-trunk - Feature #5903][Open] Optimize st_table (take 2) — Yura Sokolov <funny.falcon@...>

18 messages 2012/01/17

[ruby-core:42045] [Ruby 1.8 - Bug #5876][Open] Within one module, including second module in a class causes errors in class equivalence ('object.class ==' is wrong)

From: Nick Gunther <nlgunther@...>
Date: 2012-01-10 20:59:24 UTC
List: ruby-core #42045
Issue #5876 has been reported by Nick Gunther.

----------------------------------------
Bug #5876: Within one module, including second module in a class causes errors in class equivalence ('object.class ==' is wrong)
https://bugs.ruby-lang.org/issues/5876

Author: Nick Gunther
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-mingw32]


If within one module, another module is included in a class, including a built-in class like Array, the equivalence operators '==' and '!=' for that class produce errors.  The general form that produces the error is:
module Module1
     class C
           include Module2
     end
end
c = Module1::C.new
puts (c.class == C ? 'correct' : 'incorrect')

produces 'incorrect'

The output from the attached code illustrates the problem with the built-in class Array:
ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-mingw32]
FIRST: Testing Within a Module: Displays the Problem and the Workaround
 = Converting to Strings

Compare the results for Testing Equivalences of 
Classes and Classes Converted to String:
******
Testing Class Equivalence:
The class is an array: Array
But we're in the branch where array class equivalence
tested false, so there's a problem!
WORKAROUND: Testing Equivalence After Converting to Strings:
No Problem
SECOND: Testing Outside a Module: No problem

Class and Class Converted to String:
******
Testing Class Equivalence
No Problem
Testing Equivalence After Converting to Strings
No Problem


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

In This Thread

Prev Next