[MacRuby] #984: strange scoping error in macirb

MacRuby ruby-noreply at macosforge.org
Fri Oct 29 00:40:50 PDT 2010


#984: strange scoping error in macirb
-------------------------------------+--------------------------------------
 Reporter:  mcowan@…                 |       Owner:  lsansonetti@…        
     Type:  defect                   |      Status:  new                  
 Priority:  blocker                  |   Milestone:                       
Component:  MacRuby                  |    Keywords:  eval for-loop        
-------------------------------------+--------------------------------------
Changes (by eloy.de.enige@…):

  * keywords:  macirb => eval for-loop
  * owner:  eloy.de.enige@… => lsansonetti@…


Comment:

 Works without eval:

 {{{
 $ macruby -e "i = 0; for i in 1..2 do; puts i; end"
 1
 2
 }}}

 Fails as reported with eval and specific binding:
 {{{
 $ macruby -e "eval('i = 0; for i in 1..2 do; puts i; end',
 TOPLEVEL_BINDING)"
 /Users/eloy/code/DietRB/(eval):1:in `block': undefined local variable or
 method `i' for main:TopLevel (NameError)
         from /Users/eloy/code/DietRB/(eval):1:in `<main>'
         from -e:1:in `<main>'
 }}}

 Hits an assertion with eval and no specific binding:
 {{{
 $ macruby -e "eval('i = 0; for i in 1..2 do; puts i; end')"
 Assertion failed: (current_block), function compile_lvar_slot, file
 compiler.cpp, line 6177.
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/984#comment:4>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list