Open hsgubert opened 10 years ago
So this is a default value that should be reused over and over again as the "missing key" value?
On Sat, Jun 14, 2014 at 7:09 AM, hsgubert notifications@github.com wrote:
Great gem!
I'm really missing the "default value" feature the ruby hash has:
hash = Hash.new(default_value)
I would love to contribute with the gem, but I could not undestand the code. I have never worked with ruby wrappers for other languages libraries, and the code uses a lot of metaprogramming that I could not understand.. =/
— Reply to this email directly or view it on GitHub https://github.com/rdp/google_hash/issues/29.
Yes, that is right!
You can save tons of memory by returning the same value/object when the hash is accessed with a missing key. It is way better than to populate the hash with this default value for all possible missing keys.
From: Roger Pack Sent: Monday, August 25, 2014 9:23 AM To: rdp/google_hash Cc: Henrique Gubert
So this is a default value that should be reused over and over again as the "missing key" value?
On Sat, Jun 14, 2014 at 7:09 AM, hsgubert notifications@github.com wrote:
Great gem!
I'm really missing the "default value" feature the ruby hash has:
hash = Hash.new(default_value)
I would love to contribute with the gem, but I could not undestand the code. I have never worked with ruby wrappers for other languages libraries, and the code uses a lot of metaprogramming that I could not understand.. =/
— Reply to this email directly or view it on GitHub https://github.com/rdp/google_hash/issues/29.
— Reply to this email directly or view it on GitHub.
Great gem!
I'm really missing the "default value" feature the ruby hash has:
hash = Hash.new(default_value)
I would love to contribute to the gem, but I could not undestand the code. I have never worked with ruby wrappers for other languages libraries, and the code uses a lot of metaprogramming that I could not understand.. =/