[#76442] [Ruby trunk Feature#11741] Migrate Ruby to Git from Subversion — naruse@...
Issue #11741 has been updated by Yui NARUSE.
3 messages
2016/07/19
[#76515] [Ruby trunk Bug#12610] webrick: protect from httpoxy — nagachika00@...
Issue #12610 has been updated by Tomoyuki Chikanaga.
3 messages
2016/07/22
[ruby-core:76409] [Ruby trunk Feature#12300] Allow Object#clone to take freeze: false keyword argument to not freeze the clone
From:
matz@...
Date:
2016-07-19 05:47:52 UTC
List:
ruby-core #76409
Issue #12300 has been updated by Yukihiro Matsumoto.
Sounds reasonable.
Matz.
----------------------------------------
Feature #12300: Allow Object#clone to take freeze: false keyword argument to not freeze the clone
https://bugs.ruby-lang.org/issues/12300#change-59649
* Author: Jeremy Evans
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
This allows Object#clone to not freeze the resulting object, which fixes a long standing problem in ruby in that you cannot get an unfrozen copy of an object that includes a copy of the object's singleton class. Previously, clone always returned a frozen object, and dup did not copy the singleton class. This adds the ability to get an unfrozen clone of an object that includes a copy of the object's singleton class, allowing further modification.
Among other things, this allows the ability to create modified clones of objects that have singleton classes:
~~~
class A
def clone(arg)
obj = super(freeze: false)
# modify obj based on arg
obj.freeze
end
end
~~~
I think this is a simpler and more flexible approach to the same problem that #12092 tries to solve.
---Files--------------------------------
0001-Allow-clone-to-take-freeze-false-keyword-argument-to.patch (3.93 KB)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>