[#62904] [ruby-trunk - Feature #9894] [Open] [RFC] README.EXT: document rb_gc_register_mark_object — normalperson@...
Issue #9894 has been reported by Eric Wong.
3 messages
2014/06/02
[#63321] [ANN] ElixirConf 2014 - Don't Miss Jos辿 Valim and Dave Thomas — Jim Freeze <jimfreeze@...>
Just a few more weeks until ElixirConf 2014!
6 messages
2014/06/24
[#63391] Access Modifiers (Internal Interfaces) — Daniel da Silva Ferreira <danieldasilvaferreira@...>
Hi,
3 messages
2014/06/28
[ruby-core:62973] [ruby-trunk - Bug #5828] [Closed] Non anonymous classes can't be frozen, cloned and then inspected
From:
akr@...
Date:
2014-06-07 02:41:14 UTC
List:
ruby-core #62973
Issue #5828 has been updated by Akira Tanaka.
Status changed from Feedback to Closed
% Done changed from 0 to 100
Applied in changeset r46370.
----------
* object.c (rb_mod_initialize_clone): Override Kernel#initialize_clone
to avoid an exception on Class.new.freeze.clone.to_s.
Reported by Andrew Grimm. [ruby-core:41858] [Bug #5828]
----------------------------------------
Bug #5828: Non anonymous classes can't be frozen, cloned and then inspected
https://bugs.ruby-lang.org/issues/5828#change-47068
* Author: Andrew Grimm
* Status: Closed
* Priority: Low
* Assignee: Akira Tanaka
* Category:
* Target version:
* ruby -v: ruby 2.0.0dev (2011-11-27 trunk 33860) [x86_64-darwin10.8.0]
* Backport:
----------------------------------------
=begin
If you assign a class to a constant (that is, it isn't anonymous), and you freeze it and then clone it, you can't call to_s on it.
MyClass = Class.new ; MyClass.freeze.clone.to_s
RuntimeError: can't modify frozen Class
from (irb):1:in `to_s'
from (irb):1
from /Users/agrimm/.rvm/rubies/ruby-head/bin/irb:16:in `<main>'
MyConstantObject = Object.new ; MyConstantObject.freeze.clone.to_s # => "#<Object:0x00000100884d60>"
MyClass_2 = Class.new ; MyClass_2.clone.to_s # => "#<Class:0x00000100872930>"
MyClass_3 = Class.new ; MyClass_3.freeze.to_s # => "MyClass_3"
MyClass_4 = Class.new.freeze ; MyClass_4.clone.to_s # => "#<Class:0x0000010088d4d8>"
MyClass_5 = Class.new.freeze ; MyClass_5.freeze.clone.to_s # => An exception
local_variable_class = Class.new ; local_variable_class.freeze.clone.to_s # => "#<Class:0x00000100964028>"
Presumably this is caused by class only determining whether it's assigned to a constant when it's first inspected.
I don't have a use case for freezing and cloning a class.
=end
--
https://bugs.ruby-lang.org/