[#14696] Inconsistency in rescuability of "return" — Charles Oliver Nutter <charles.nutter@...>

Why can you not rescue return, break, etc when they are within

21 messages 2008/01/02

[#14738] Enumerable#zip Needs Love — James Gray <james@...>

The community has been building a Ruby 1.9 compatibility tip list on =20

15 messages 2008/01/03
[#14755] Re: Enumerable#zip Needs Love — Martin Duerst <duerst@...> 2008/01/04

Hello James,

[#14772] Manual Memory Management — Pramukta Kumar <prak@...>

I was thinking it would be nice to be able to free large objects at

36 messages 2008/01/04
[#14788] Re: Manual Memory Management — Marcin Raczkowski <mailing.mr@...> 2008/01/05

I would only like to add that RMgick for example provides free method to

[#14824] Re: Manual Memory Management — MenTaLguY <mental@...> 2008/01/07

On Sat, 5 Jan 2008 15:49:30 +0900, Marcin Raczkowski <mailing.mr@gmail.com> wrote:

[#14825] Re: Manual Memory Management — "Evan Weaver" <evan@...> 2008/01/07

Python supports 'del reference', which decrements the reference

[#14838] Re: Manual Memory Management — Marcin Raczkowski <mailing.mr@...> 2008/01/08

Evan Weaver wrote:

[#14911] Draft of some pages about encoding in Ruby 1.9 — Dave Thomas <dave@...>

Folks:

24 messages 2008/01/10

[#14976] nil encoding as synonym for binary encoding — David Flanagan <david@...>

The following just appeared in the ChangeLog

37 messages 2008/01/11
[#14977] Re: nil encoding as synonym for binary encoding — Yukihiro Matsumoto <matz@...> 2008/01/11

Hi,

[#14978] Re: nil encoding as synonym for binary encoding — Dave Thomas <dave@...> 2008/01/11

[#14979] Re: nil encoding as synonym for binary encoding — David Flanagan <david@...> 2008/01/11

Dave Thomas wrote:

[#14993] Re: nil encoding as synonym for binary encoding — Dave Thomas <dave@...> 2008/01/11

[#14980] Re: nil encoding as synonym for binary encoding — Gary Wright <gwtmp01@...> 2008/01/11

[#14981] Re: nil encoding as synonym for binary encoding — Yukihiro Matsumoto <matz@...> 2008/01/11

Hi,

[#14995] Re: nil encoding as synonym for binary encoding — David Flanagan <david@...> 2008/01/11

Yukihiro Matsumoto writes:

[#15050] how to "borrow" the RDoc::RubyParser and HTMLGenerator — Phlip <phlip2005@...>

Core Rubies:

17 messages 2008/01/13
[#15060] Re: how to "borrow" the RDoc::RubyParser and HTMLGenerator — Eric Hodel <drbrain@...7.net> 2008/01/14

On Jan 13, 2008, at 08:54 AM, Phlip wrote:

[#15062] Re: how to "borrow" the RDoc::RubyParser and HTMLGenerator — Phlip <phlip2005@...> 2008/01/14

Eric Hodel wrote:

[#15073] Re: how to "borrow" the RDoc::RubyParser and HTMLGenerator — Eric Hodel <drbrain@...7.net> 2008/01/14

On Jan 13, 2008, at 20:35 PM, Phlip wrote:

[#15185] Friendlier methods to compare two Time objects — "Jim Cropcho" <jim.cropcho@...>

Hello,

10 messages 2008/01/22

[#15194] Can large scale projects be successful implemented around a dynamic programming language? — Jordi <mumismo@...>

A good article I have found (may have been linked by slashdot, don't know)

8 messages 2008/01/24

[#15248] Symbol#empty? ? — "David A. Black" <dblack@...>

Hi --

24 messages 2008/01/28
[#15250] Re: Symbol#empty? ? — Yukihiro Matsumoto <matz@...> 2008/01/28

Hi,

Re: bug?

From: Rolando Abarca <funkaster@...>
Date: 2008-01-02 15:36:52 UTC
List: ruby-core #14694
On Dec 31, 2007, at 11:54 PM, murphy wrote:

> Rolando Abarca wrote:
>> Doing some evals, I got this:
> can you refactor it into a single file that fails? so we can reproduce
> it and add it to knownbug, for example.
> [murphy]


ok, I got the problem, it was the eval'ed code: it was not catching an  
exception:

#!/opt/ruby1.9/bin/ruby

module M
   class A
     class A2
       attr_accessor :at1, :at2
     end

     class << self
       def workflow_rule
         obj = A2.new
         yield obj
         @arr ||= []
         @arr << obj
       end

       def eval_str(str)
         begin
           eval(str, binding)
         rescue => err
           puts "something happened: #{err}"
         end
       end

       def eval_file(file)
         eval_str(File.read(file))
       end
     end
   end
end

M::A.eval_str(DATA.read)

__END__
workflow_rule do |r|
   r.at1 = "at1"
   r.at2 = "at2"
   r.at2 -> { puts "this shows a bug" }
end

The problem was that I forgot to put the assignment operator when  
setting an attribute to the instance "r", although this is an error, I  
think it should not raise a bug in ruby:

{rolando@s-puck 12:33:50}$ /opt/ruby1.9/bin/ruby bug.rb
(eval):4: [BUG] Stack consistency error (sp: 26, bp: 25)
ruby 1.9.0 (2007-12-25 revision 14709) [i686-darwin9.1.0]

-- control frame ----------
c:0009 p:0047 s:0026 b:0025 l:00087c d:001474 BLOCK  (eval):4
c:0008 p:0020 s:0023 b:0023 l:000022 d:000022 METHOD bug.rb:12
c:0007 p:0007 s:0019 b:0019 l:00087c d:000a80 EVAL   (eval):1
c:0006 p:---- s:0018 b:0018 l:000017 d:000017 FINISH :inherited
c:0005 p:---- s:0016 b:0016 l:000015 d:000015 CFUNC  :eval
c:0004 p:0016 s:0011 b:0011 l:00087c d:00087c METHOD bug.rb:19
c:0003 p:0035 s:0006 b:0006 l:000005 d:000005 TOP    bug.rb:32
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH :inherited
c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP    <dummy toplevel>: 
37724
---------------------------
DBG> : "bug.rb:12:in `workflow_rule'"
DBG> : "(eval):1:in `eval_str'"
DBG> : "bug.rb:19:in `eval'"
DBG> : "bug.rb:19:in `eval_str'"
DBG> : "bug.rb:32:in `<main>'"
-- backtrace of native function call (Use addr2line) --
0xdb476
0x1b7dc
0x1b81b
0xd93ac
0xd9b0c
0x2511f
0x254a6
0xce555
0xd1900
0xd5794
0xd9b0c
0xd9dd9
0x1ec94
0x237fa
0x23cf
0x2336
-------------------------------------------------------
Abort trap
{rolando@s-puck 12:33:52}$ ruby bug.rb
something happened: wrong number of arguments (1 for 0)

Notice that I changed the last line of the eval'ed code from -> to  
Proc.new, in order for the example to work with ruby 1.8.

regards,
-- 
Rolando Abarca
Phone: +56-9 97851962
My Amazon Wish List: http://www.amazon.com/gp/registry/wishlist/3AGJOT5E6SIQB


In This Thread