From: Kent Dahl Date: 2002-06-05T04:19:49+09:00 Subject: Re: When should actually freeze work ? Philip Mateescu wrote: > I have the following cases where I thought freeze should work. It doesn't, > and I have no clue as to why... (in all cases assignment seems to cancel the > values). Common newbie misunderstanding. Please remember that all variables are simply references to objects. Freeze applies to the objects themselves. Assignment makes a variable refer to a different object, which does not affect the frozen object. > s = "123" # doesn't throw a can't modify frozen string. why ? > s.frozen? # >> false (but I thought I told it to freeze :) Yup, but you have a different string now in s. The frozen one is probably floating around in ObjectSpace, waiting to get GC'ed. HTH To all: I've seen this kind of question a few times now, but can't locate it in the FAQ. -- (\[ Kent Dahl ]/)_ _~_ __[ http://www.stud.ntnu.no/~kentda/ ]___/~ ))\_student_/(( \__d L b__/ NTNU - graduate engineering - 4. year ) ( \__\_�|�_/__/ ) _)Industrial economics and technological management( \____/_�_\____/ (____engineering.discipline_=_Computer::Technology___)