Hacker News new | past | comments | ask | show | jobs | submit login

Curious to read this and not see a reference to Ruby.

In Ruby hashes are ordered by insertion, can have any object as keys, but the hash key value can be defined on a class by class basis (by overriding the default `hash` method on the class).

The ordering is one of those features that I need very infrequently, but when I do it significantly simplifies that bit of code.

I've always found the usefulness and flexibilty of Ruby's hashes to be a double-edged sword though: they are extremely useful, but this leads people to use them in situations where defining a proper class might be better for long-term maintenance.




I've used this feature of Ruby Hashes to create something that behaves like a a LRU cache :)


Interesting, I'm trying to work out how that would work. Would you mind giving a quick overview?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: