[MacRuby] #1139: MacRuby inconsistent compared to CRuby when breaking from hash enumeration

MacRuby ruby-noreply at macosforge.org
Fri Jan 28 21:34:21 PST 2011


#1139: MacRuby inconsistent compared to CRuby when breaking from hash enumeration
------------------------------------+---------------------------------------
 Reporter:  mrada@…                 |       Owner:  lsansonetti@…        
     Type:  defect                  |      Status:  new                  
 Priority:  blocker                 |   Milestone:                       
Component:  MacRuby                 |    Keywords:                       
------------------------------------+---------------------------------------
 When I iterate over a hash in CRuby and `break` during one iteration the
 iteration will  return value to be nil. If I try the same thing in MacRuby
 I will get the same return value that I would have gotten had the
 iteration finished.

 I found this problem with Hash objects, an Array has the same behaviour in
 this case on CRuby and MacRuby.

 With the CRuby irb:

      ruby-1.9.2-p136 :001 > { test:'pair' }.each_pair { |key,value| break
 }
       => nil
      ruby-1.9.2-p136 :002 > { test:'pair' }.each_pair { |key,value| key }
       => {:test=>"pair"}
      ruby-1.9.2-p136 :003 >

 With the MacRuby irb:

      irb(main):001:0> { test:'pair' }.each_pair { |key,value| break }
      => {:test=>"pair"}
      irb(main):002:0> { test:'pair' }.each_pair { |key,value| key }
      => {:test=>"pair"}
      irb(main):003:0>

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1139>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list