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

For `arr.length` where arr is a local, the disassembly shows `opt_length` rather than a generic send. What does this specialized instruction do that a generic method call would not, and what is its safety condition?

RubyVM::InstructionSequence.compile('a=[1,2,3]; a.length').disasm # ... opt_length <calldata!mid:length, argc:0, ARGS_SIMPLE>