From: Marc-Andre Lafortune Date: 2009-12-21T15:14:29+09:00 Subject: [ruby-core:27260] [Feature #2509] Recursive freezing? Issue #2509 has been updated by Marc-Andre Lafortune. I'm sorry for not having been more precise. My proposal would affect directly Array, Hash, Range & Struct. Traversal would be guarded against infinite recursion, like #inspect and al. Enumerator simply forwards the recursive call to the arguments used when contructing them, as if these were stored as instance variables. In std libraries: OpenStruct: nothing special to do (since sub objects are stored as instance variables) Delegate: To be more intuitive, they probably should not decrement the level to freeze, so that freezing a given object by 2 levels would have a similar effect than freezing its delegate by 2 levels. Set: Uses a hash, so should also forward the call without decrementing the level. Freezing a set would thus have similar effect to freezing an array. StringIO: Forwards the call to the underlying string. I feel the the lambda example is not an issue. The local variable "a" doesn't belong to the lambda, and lambdas have no mutating methods anyways, so any_lambda.freeze, any_lambda.freeze(-1) have the same (trivial) effect (unless they somehow get instance variables, in which case these get frozen like any other object). ---------------------------------------- http://redmine.ruby-lang.org/issues/show/2509 ---------------------------------------- http://redmine.ruby-lang.org