[MacRuby-devel] [MacRuby] #798: Processing after Proc is not executed when use Proc in lambda, and when calls `return' in Proc.

2010-07-16 Thread MacRuby
#798: Processing after Proc is not executed when use Proc in lambda, and when
calls `return' in Proc.
--+-
 Reporter:  watson1...@…  |   Owner:  lsansone...@…
 Type:  defect|  Status:  new  
 Priority:  blocker   |   Milestone:   
Component:  MacRuby   |Keywords:   
--+-
 Test Script:
 {{{
 $ cat test_proc.rb
 def test_lambda_lambda
   lambda {
 lambda {
   return
 }.call
   }.call
   p "test_lambda_lambda"

   :ok
 end

 def test_lambda_proc
   lambda {
 Proc.new {
   return
 }.call
   }.call
   p "test_lambda_proc"

   :ok
 end

 def test_proc_proc
   Proc.new {
 Proc.new {
   return
 }.call
   }.call
   p "test_proc_proc"

   :ng
 end

 p test_lambda_lambda
 p test_lambda_proc
 p test_proc_proc
 }}}

 Result of Ruby 1.9.1:
 {{{
 $ ruby test_proc.rb
 "test_lambda_lambda"
 :ok
 "test_lambda_proc"
 :ok
 nil
 }}}

 Result of MacRuby Trunk:
 {{{
 $ macruby test_proc.rb
 "test_lambda_lambda"
 :ok
 nil
 nil
 }}}

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] [MacRuby] #799: Abort occurs when will raise LocalJumpError with Proc.

2010-07-16 Thread MacRuby
#799: Abort occurs when will raise LocalJumpError with Proc.
--+-
 Reporter:  watson1...@…  |   Owner:  lsansone...@…
 Type:  defect|  Status:  new  
 Priority:  blocker   |   Milestone:   
Component:  MacRuby   |Keywords:   
--+-
 Test Script:
 {{{
 $ cat test_proc_2.rb
 def get_me_a_return
   Proc.new { return 42 }
 end
 get_me_a_return.call  # => LocalJumpError: unexpected return
 }}}

 Result of MacRuby Trunk:
 {{{
 $ macruby test_proc_2.rb
 uncaught Objective-C/C++ exception...
 terminate called after throwing an instance of
 'RoxorReturnFromBlockException*'
 zsh: abort  macruby test_proc_2.rb
 }}}

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #798: Processing after Proc is not executed when use Proc in lambda, and when calls `return' in Proc.

2010-07-16 Thread MacRuby
#798: Processing after Proc is not executed when use Proc in lambda, and when
calls `return' in Proc.
--+-
 Reporter:  watson1...@…  |   Owner:  lsansone...@…
 Type:  defect|  Status:  new  
 Priority:  blocker   |   Milestone:   
Component:  MacRuby   |Keywords:   
--+-

Old description:

> Test Script:
> {{{
> $ cat test_proc.rb
> def test_lambda_lambda
>   lambda {
> lambda {
>   return
> }.call
>   }.call
>   p "test_lambda_lambda"
>
>   :ok
> end
>
> def test_lambda_proc
>   lambda {
> Proc.new {
>   return
> }.call
>   }.call
>   p "test_lambda_proc"
>
>   :ok
> end
>
> def test_proc_proc
>   Proc.new {
> Proc.new {
>   return
> }.call
>   }.call
>   p "test_proc_proc"
>
>   :ng
> end
>
> p test_lambda_lambda
> p test_lambda_proc
> p test_proc_proc
> }}}
>
> Result of Ruby 1.9.1:
> {{{
> $ ruby test_proc.rb
> "test_lambda_lambda"
> :ok
> "test_lambda_proc"
> :ok
> nil
> }}}
>
> Result of MacRuby Trunk:
> {{{
> $ macruby test_proc.rb
> "test_lambda_lambda"
> :ok
> nil
> nil
> }}}

New description:

 Test Script:
 {{{
 #!ruby
 $ cat test_proc.rb
 def test_lambda_lambda
   p "test_lambda_lambda"
   lambda {
 lambda {
   return :ng
 }.call
   }.call
   return :ok
 end

 def test_lambda_proc
   p "test_lambda_proc"
   lambda {
 Proc.new {
   return :ng
 }.call
   }.call
   return :ok
 end

 def test_proc_proc
   p "test_proc_proc"
   Proc.new {
 Proc.new {
   return :ok
 }.call
   }.call
   return :ng
 end

 p test_lambda_lambda
 p test_lambda_proc
 p test_proc_proc
 }}}

 Result of Ruby 1.9.1:
 {{{
 "test_lambda_lambda"
 :ok
 "test_lambda_proc"
 :ok
 "test_proc_proc"
 :ok
 }}}

 Result of MacRuby Trunk:
 {{{
 $ macruby test_proc.rb
 "test_lambda_lambda"
 :ok
 "test_lambda_proc"
 :ng
 "test_proc_proc"
 :ok
 }}}

 Ruby 1.8:
 {{{
 "test_lambda_lambda"
 :ok
 "test_lambda_proc"
 :ng
 "test_proc_proc"
 :ok
 }}}

--

Comment(by martinlagarde...@…):

 (modified the test to make the situation a little clearer)

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel