Thought provoking idea of the day: A colleague suggested that Hash#keys should return a Set, instead of an Array in Ruby 
-
-
-
A hash set is usually implemented as a thin wrapper around a hash map (this is true in Ruby specifically) so no it would not be.
1 reply 0 retweets 0 likes -
Not sure what the benefit would be though since the values are already guaranteed to be unique.
1 reply 0 retweets 0 likes -
Yeah, I agree. I'm guessing that it's just the reinforcement of uniqueness?
1 reply 0 retweets 0 likes -
The idea was that you most commonly want to do set-like operations on the list of keys.
2 replies 0 retweets 0 likes -
In theory you could implement `keys` to return a set in constant time as well, but I don't know if it's implemented in Ruby to work that way
1 reply 0 retweets 0 likes
If nothing else the returned set would have to be immutable, which is not trivial to do in Ruby without cloning the underlying map
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.