Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
Hash freezes String keys are returns copy
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Robert Klemme, post: 4452440"] Yes, it's a special optimization for string keys. You can get your original out if you freeze it before putting it into the hash. :-) In fact, that might be a performance optimization if you put *a lot* string keys into the hash. Because copying an instance is relatively expensive this pattern was not adopted generally, i.e. you have to take care of Array and other keys yourself. Note also, that you need to rehash if you change your array instance after using it as Hash key. Kind regards robert [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
Hash freezes String keys are returns copy
Top