From: "marcandre (Marc-Andre Lafortune)" Date: 2013-09-01T04:47:30+09:00 Subject: [ruby-core:56949] [ruby-trunk - Feature #2509] Recursive freezing? Issue #2509 has been updated by marcandre (Marc-Andre Lafortune). Thanks for considering it. I am a bit surprised about the reason for your rejection. I mean, there are many ways in Ruby to shoot yourself in the foot and that is not a problem in my opinion. I'm also sceptical as to how many objects that you would want to freeze contain a reference to a class. In any case, if the problem really is of classes freezing, it would be easy to make Class#deep_freeze private to prevent that. ---------------------------------------- Feature #2509: Recursive freezing? https://bugs.ruby-lang.org/issues/2509#change-41508 Author: marcandre (Marc-Andre Lafortune) Status: Rejected Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: core Target version: next minor =begin I like freezing my constants, config files I read, etc... I believe it is the typical use case for #freeze. In all theses cases, what I really want to do is freeze everything. There is often no easy way to do this (e.g. for config files), or else one must explicitly call freeze a bunch of times, like: DEFAULT_SEND_FILE_OPTIONS = { :type => 'application/octet-stream'.freeze, :disposition => 'attachment'.freeze, }.freeze It would be very nice if there was an easy way to freeze recursively arrays, hashes, etc... A solution would be for #freeze to accept a level argument (similar to flatten, but the default being 1), or alternatively a boolean one (recursive = false). Should I write a patch for this feature request? Thanks, Marc-Andr�� =end -- http://bugs.ruby-lang.org/