[MacRuby] #952: Should set got string to $_ when calls StringIO#gets #readline.

MacRuby ruby-noreply at macosforge.org
Sun Dec 5 05:15:53 PST 2010


#952: Should set got string to $_ when calls StringIO#gets #readline.
----------------------------------+-----------------------------------------
 Reporter:  watson1978@…          |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  minor                 |   Milestone:  MacRuby 1.0          
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------

Comment(by warpflyght@…):

 Looks like you can't in MacRuby. The existing implementation tries to
 assign $_:
 {{{
   def gets(sep=$/)
     $_ = getline(sep)
   end
 }}}

 You can assign $_ in Snow Leopard's stock Ruby 1.8.7, as well as a Ruby
 1.9.2p0 build I installed with MacPorts. So, we have a reduction:
 {{{
 $ ruby -e "\$_ = 'foo'; puts \$_.inspect"
 "foo"
 $ ruby1.9 -e "\$_ = 'foo'; puts \$_.inspect"
 "foo"
 $ macruby -e "\$_ = 'foo'; puts \$_.inspect"
 nil
 }}}

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



More information about the macruby-tickets mailing list