From: konsu Date: 2006-02-16T09:48:28+09:00 Subject: why does this freeze not work? hello, i need to set an instance variable in my object once and make sure this variable is not changed afterwards. i tried the code below which i expected to fail with a TypeError but it happily outputs '2'. i kind of understand why it succeeds, i think it just creates another @id when i call id=() method, but is there a way to do what i want to do? thanks konstantin class C attr_accessor :id def initialize(id) @id = id @id.freeze end end c = C.new(1) c.id = 2 puts c.id