From: gabriele renzi Date: 2004-06-10T18:28:39+09:00 Subject: strange SDBM behaviour hi gurus and nubys, I just noticed this: >> db=SDBM.new 'foo', 0666 => # >> db[:foo]=10 => 10 >> db.keys => ["foo"] >> db[:foo] TypeError: cannot convert Symbol into String from (irb):8:in `[]' from (irb):8 It seem that []= uses to_s while [] uses to_str: >> class C >> def to_s >> 'miao' >> end >> def to_str >> raise 'fuku fukissimo fuku' >> end >> end => nil >> db[C.new]=30 => 30 >> db.keys => ["foo", "miao"] >> db[C.new] RuntimeError: fuku fukissimo fuku from (irb):16:in `to_str' from (irb):21:in `[]' from (irb):21 is this an expected behaviour? I believe wheter SDBM uses the one or the other it should be consistent in hi choice :) Anyway: ruby 1.8.1 (2003-12-25) [i386-mswin32] Can't say what version sdbm is, given that VERSION refers to 1.8.1 and SDBM::constants == []