5 ms·
This bit of ruby should take care of it HashMap = HashTable = Map = Table = Dictionary = Hash And if you're feeling adventurous, Object.send :remove_
by markov_twain 14y ago
This bit of ruby should take care of it
HashMap = HashTable = Map = Table = Dictionary = Hash
And if you're feeling adventurous,
Object.send :remove_const, :Hash
- agscala 14y agoPlease never, ever do this
- DanWaterworth 14y agoIf doing this is such a bad idea then why is it so easy?
- jlgreco 14y agoIf doing: #define BEGIN { #define END } were such a bad idea, then why is it so easy?
- DanWaterworth 14y agoMaybe the language is poorly designed.
- jlgreco 14y agoOr maybe the connection between being able to do something and it being a good idea to do something is just in your head.
- DanWaterworth 14y agoIn my experience, making obviously bad things difficult or impossible improves reliability. This idea certainly resides within my cranial cavity, but that doesn't necessarily make it wrong.
- jlgreco 14y agoHow could: HashMap = HashTable = Map = Table = Dictionary = Hash possibly not qualify as "obviously bad"? The only reason you've offered up is because it is easy...
- DanWaterworth 14y agoI think this is fine. The obviously bad part is being able to remove/change constants, especially as these changes are global.
- agscala 14y agoThe obviously bad part is that you pollute the global namespace for no reason other than laziness. When someone comes across code that uses a "Table" object interchangeably with "Dictionary" and "Hash", then he's going to have to look through the source code to find this bizarre line only to find out that you renamed a built-in container for no good reason.
- DanWaterworth 14y agoYes, I suppose that's also true.
- knewter 14y agoI approve of this. Don't listen to that other guy. This should be standard. One addition though: Cocktionary = HashMap "Dictionary" never really made sense.