From: eregontp@... Date: 2020-03-19T01:04:45+00:00 Subject: [ruby-core:97542] [Ruby master Feature#16175] Object#clone(freeze: true) is inconsistent with Object#clone(freeze: false) Issue #16175 has been updated by Eregon (Benoit Daloze). To clarify I'm not against the PR, but it seems a very niche use-case to me with no real-world example, and IMHO the documentation was clear enough. I think #clone is about copying state, not about changing other aspects like freezing when the original wasn't. ---------------------------------------- Feature #16175: Object#clone(freeze: true) is inconsistent with Object#clone(freeze: false) https://bugs.ruby-lang.org/issues/16175#change-84701 * Author: zverok (Victor Shepelev) * Status: Open * Priority: Normal ---------------------------------------- In #12300, the new keyword `freeze:` was introduced, allowing this: ```ruby h = {}.freeze h.clone.frozen? # => true h.clone(freeze: false).frozen? # => false ``` Though, it turns to me that behavior is not symmetric: ```ruby h = {} h.frozen? # => false h.clone.frozen? # => false h.clone(freeze: true).frozen? # => false -- I expected true here! ``` I wonder, if it is "by design" and should be addressed in docs, or just an implementation inconsistency that can be fixed? ---Files-------------------------------- freeze-true.patch (1.47 KB) clone-freeze-true-16175.patch (4.42 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: