Now, Integer and Float objects are frozen objects.
How about to freeze Symbol objects, too?
I think Symbol is friend of Integer.
p :foo.frozen? #=> false
p :foo.instance_variable_get(:@foo) #=> 1
Background of this proposal:
Now, I'm working on "GC-able Symbols" feature.
Freezing symbols make this feature easier.
(1) set an instance variable @iv for symbol s
(2) collect s
(3) generate s
(4) what value of @iv for s returns?
Updated by ko1 (Koichi Sasada) about 9 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r42974.
Koichi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- include/ruby/ruby.h: make Symbol objects frozen.
I want to freeze this good day, too.
- test/ruby/test_eval.rb: catch up this change.
- test/ruby/test_symbol.rb: add a test to check frozen symbols.