From: Andrew Hunt Date: 2000-04-19T15:40:30-04:00 Subject: [ruby-talk:02514] frozen behavior Hi everyone, I've got a quick question regarding the behavior of "frozen". Are you supposed to be able to add methods to a frozen object? ObjectSpace.each_object() {|x| begin def x.something "foo" end rescue puts "Trying to modify #{x.type} #{x.inspect}: #{$!}" end } Results in: Trying to modify String "Struct": can't modify frozen object Trying to modify String "File": can't modify frozen object Trying to modify String "\n": can't modify frozen object Trying to modify String "Errno": can't modify frozen object Is this correct behavior? And what is magic about these four strings that they are frozen? Thanks... /\ndy -- Andrew Hunt, The Pragmatic Programmers, LLC. Innovative Object-Oriented Software Development web: http://www.pragmaticprogrammer.com email: andy@pragmaticprogrammer.com -- Our New Book: "The Pragmatic Programmer" Published by Addison-Wesley Oct 1999 (see www.pragmaticprogrammer.com/ppbook) --