[#74190] [Ruby trunk Feature#12134] Comparison between `true` and `false` — duerst@...
SXNzdWUgIzEyMTM0IGhhcyBiZWVuIHVwZGF0ZWQgYnkgTWFydGluIETDvHJzdC4KCgpUc3V5b3No
3 messages
2016/03/07
[#74269] Type systems for Ruby — Rob Blanco <ml@...>
Dear ruby-core,
5 messages
2016/03/10
[#74395] [Ruby trunk Feature#12142] Hash tables with open addressing — shyouhei@...
Issue #12142 has been updated by Shyouhei Urabe.
3 messages
2016/03/17
[ruby-core:74369] [Ruby trunk Feature#12092][Feedback] Allow Object#clone to yield cloned object before freezing
From:
nobu@...
Date:
2016-03-16 09:03:57 UTC
List:
ruby-core #74369
Issue #12092 has been updated by Nobuyoshi Nakada.
Description updated
Status changed from Open to Feedback
Why does it need to be a singleton method but can't a method from an included module?
----------------------------------------
Feature #12092: Allow Object#clone to yield cloned object before freezing
https://bugs.ruby-lang.org/issues/12092#change-57489
* Author: Jeremy Evans
* Status: Feedback
* Priority: Normal
* Assignee: ruby-core
----------------------------------------
This allows creating modified clones of frozen objects that have
singleton classes:
~~~ruby
a = [1,2,3]
def a.fl; first + last; end
a.freeze
a.fl # => 4
clone = a.clone{|c| c << 10}
clone.last # => 10
clone.fl # => 11
clone.frozen? # => true
~~~
Previously, this was not possible at all. If an object was
frozen, the clone was frozen before the cloned object could
be modified. It was possible to modify the clone using
`initialize_clone` or `initialize_copy`, but you couldn't change how
to modify the clone on a per-call basis. You couldn't use `dup`
to return an unfrozen copy, modify it, and then freeze it, because
`dup` doesn't copy singleton classes.
This allows ruby to be used in a functional style with immutable
data structures, while still keeping the advantages of singleton
classes.
---Files--------------------------------
0001-Allow-clone-to-yield-cloned-object-before-freezing.patch (2.51 KB)
0001-Allow-clone-to-take-a-second-argument-passed-to-init.patch (2.37 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>