Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardRubyfrozen string dedupSingle-choice MCQ

Two distinct String objects with identical bytes and encoding are added as Hash keys. Why does interning them (via -str) before use change the Hash's storage behavior, beyond just deduplicating the objects?

h = {} h[-'k'] = 1 h[-'k'] = 2 h.size # ?