Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardRubyYARV bytecodeSingle-choice MCQ

Why does `"hello".freeze` produce different bytecode than a bare `"hello"`, and what is the observable runtime consequence?

RubyVM::InstructionSequence.compile('"hello".freeze').disasm # 0000 opt_str_freeze "hello", ... RubyVM::InstructionSequence.compile('"hello"').disasm # 0000 putstring "hello"