From: shevegen@... Date: 2019-09-22T09:30:17+00:00 Subject: [ruby-core:95029] [Ruby master Feature#16175] Make Object#clone(freeze: true) return frozen clone even if receiver is not frozen Issue #16175 has been updated by shevegen (Robert A. Heiler). I sort of agree with zverok at the least for the expectation of freeze: true working. IMO for boolean toggle-values I would think it is simpler to have both variants work; then again I don't think I need either of the two variants myself. It's interesting to point out that freeze adds a bit of complexity though. ---------------------------------------- Feature #16175: Make Object#clone(freeze: true) return frozen clone even if receiver is not frozen https://bugs.ruby-lang.org/issues/16175#change-81659 * Author: zverok (Victor Shepelev) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- 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? -- https://bugs.ruby-lang.org/ Unsubscribe: