Bugs: Browse | Submit New | Admin

[#7253] Sets and String subclasses

Date:
2006-12-13 17:26
Priority:
3
Submitted By:
Tim Smith (tsmith)
Assigned To:
Yukihiro Matsumoto (matz)
Category:
Language / Runtime / Core Libraries
State:
Open
Platform:
 
Summary:
Sets and String subclasses

Detailed description
In Ruby 1.8.4, 1.8.5, and as of 1.9.0 (2006-04-15):

class A < String
  attr_accessor :x
end

a = A.new 'hello'
a.x = 5
s = Set[a]
puts a.x # => 5
puts s.to_a[0].x # => nil

I would expect the second puts to return 5, not nil.  In fact, I'd expect s.to_a[0] to return the same object as a.

Add A Comment: Notepad

Please login


Followup

Message
Date: 2007-08-11 19:14
Sender: Shyouhei Urabe

Assigning to matz; see [ruby-core:9716]

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

Field Old Value Date By
assigned_toshyouhei2007-08-11 19:14shyouhei
assigned_tonone2007-06-12 03:22zenspider
category_idNone2007-06-12 03:14zenspider