Hamster - Efficient, Immutable, Thread-Safe Collection classes for Ruby
github.com
github.com
Hash may refer to: http://en.wikipedia.org/wiki/Hash_table
i'm sure it's not just you though, people get annoyed over whole bunch of things
If a structure is immutable, how would you be able to fuck it up, even if you abuse it via threading? I would argue the relation is so strong, that something which isn't thread-safe cannot be immutable. But there may ofcourse be something which I'm missing.
Different languages and platforms handling different key concepts differently etc.
Is there some properties of Ruby which makes this possible, or gives you a need for a double-guarantee, or is the declaration here simply redundant?
But I guess at this point we are starting to argue technicalities and it's getting quite outside the scope of this submission.
I'll just take a mental note with regard to immutable evidently being a lossy concept ;)
In any case, ruby is really missing something as good as this. Very nice stuff. Wish that it did not require "new" syntax compared to ruby's nice [ ] and { }. But whatever. This is a problem that will exist on any collection innovation.
def dup
self
end
Weehee, immutability is great at some things.* https://github.com/celluloid/celluloid
* https://github.com/mperham/sidekiq (built on Celluloid)
* https://github.com/puma/puma
* http://tenderlovemaking.com/2012/06/18/removing-config-threa...
If I wanted to do concurrent programs, I usually chose C :)
1499 lines of Ruby code.
19 lines of comments.
Nope, nope, nope. I would never touch this library.
Good amount of tests, but the moment this library doesn't work as expected and you need to jump into the code, you're completely screwed.
Not usable.
I don't think you're giving yourself enough credit.
A quick glance at the source shows that the size of the program is a result of implementing the many methods one expects from collection classes in Ruby, not because the code is especially byzantine. In fact, I haven't seen a single instance of class inheritance; the author seems to have chosen to solely use a few well defined modules instead.
Comments often tend to explain the same thing as the code exactly does and what you see w/o looking at the comment. Also, they tend to be forgotten - if someone changes the code, he/she often doesn't change the comment. As a result, you'll have an outdated comment which can confuse you.
I recommend "Clean Code"[1] for more info on this subject. Beside other chapters, there's a chapter about what's a good and what's a bad comment.
[1]: http://www.amazon.com/Clean-Code-Handbook-Software-Craftsman...
In any event, I was looking for solid examples, not a general discussion on whether comments are good or bad. We clearly are not going to agree on that point so we'll save the Internet another pointless argument :-)