Hashes and Frozen Keys

4:07 PM / Comments (2) / by Nick

The hash class freezes keys that are strings:

This can be a problem if you want to use those keys later on...more specifically, if you want to extract and edit those strings:

Unfortunately, those strings will have to be duped or cloned:

2 comments:

Architect @ September 22, 2010 2:58 PM

actually, cloned objects of frozen objects are also frozen.

Nick @ September 22, 2010 3:08 PM

@Architect You're right! Thanks for pointing that out. I've updated the post.