From: ts Date: 2008-03-22T22:20:57+09:00 Subject: Re: ruby19 and defined? Rick DeNatale wrote: > Hmmmm, not so sure that that's actually a bug. It's a bug Here the bytecode vgs% ./ruby -ve 'puts VM::InstructionSequence.compile("defined?(a.b)").disasm' ruby 1.9.0 (2008-03-21 revision 15825) [i686-linux] :1: warning: useless use of defined? in void context == disasm: @>================================= 0000 putself ( 1) 0001 defined 21, :a, false 0005 leave 0006 pop 0007 branchif 12 0009 putnil 0010 leave 0011 pop 0012 putnil 0013 send :a, 0, nil, 24, 0019 defined 13, :b, true 0023 leave vgs% Now if I add 'p' vgs% ./ruby -ve 'puts VM::InstructionSequence.compile("p defined?(a.b)").disasm' ruby 1.9.0 (2008-03-21 revision 15825) [i686-linux] == disasm: @>================================= 0000 putnil ( 1) 0001 putself 0002 defined 21, :a, false 0006 jump 24 0008 branchif 13 0010 putnil 0011 jump 24 0013 putnil 0014 send :a, 0, nil, 24, 0020 defined 13, :b, true 0024 send :p, 1, nil, 8, 0030 leave vgs% See the bytecode 'jump 24' in 0006 Guy Decoux