Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's fine in MRI.

    > seq = RubyVM::InstructionSequence.compile("a = 1 + 2")
     => <RubyVM::InstructionSequence:<compiled>@<compiled>>

     > puts seq.disasm
    == disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
    local table (size: 2, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
    [ 2] a
    0000 trace            1                                               (   1)
    0002 putobject_OP_INT2FIX_O_1_C_
    0003 putobject        2
    0005 opt_plus         <callinfo!mid:+, argc:1, ARGS_SIMPLE>
    0007 dup
    0008 setlocal_OP__WC__0 2
    0010 leave
     => nil

    > seq.eval
     => 3


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: