Feature #4234
closed
Hash#default_proc= Doesn't Accept nil Argument
Added by runpaint (Run Paint Run Run) almost 14 years ago.
Updated over 12 years ago.
Description
=begin
The initial value of a Hash's default Proc is the block passed to Hash.new or nil. Hash#default_proc= can set the default Proc to a given Proc, but can't reset it to nil. This is unsymmetrical.
The attached patch lets #default_proc= take a nil argument, and provides tests. This causes a RubySpec failure ("Hash#default_proc= raises an error if passed stuff not convertible to procs"), which I will fix if this patch is applied.
=end
Files
- Status changed from Open to Assigned
- Assignee set to akr (Akira Tanaka)
- Tracker changed from Bug to Feature
- Assignee changed from akr (Akira Tanaka) to matz (Yukihiro Matsumoto)
- Priority changed from 3 to Normal
- Assignee changed from matz (Yukihiro Matsumoto) to marcandre (Marc-Andre Lafortune)
Agreed. Marc, could you check this patch in (with document update)?
Matz.
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r35268.
Run Paint, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
-
hash.c (rb_hash_set_default_proc): Accept nil, patch by Run Paint
[Feature #4234]
-
test/ruby/test_hash.rb: test for above.
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0