[MacRuby-devel] RoxorReturnFromBlockException
Laurent Sansonetti
lsansonetti at apple.com
Thu Oct 29 23:43:59 PDT 2009
Hi Mike,
No, this is not by design, you found a bug :-) Please file a ticket.
Thanks,
Laurent
On Oct 29, 2009, at 11:16 PM, Mike Moore wrote:
> It looks like MacRuby doesn't allow calling return in a block, which
> works in 1.8 and 1.9. This looks to be by design, so I'm not sure if
> the team wants a ticket created. Should I create a ticket?
>
> ----------------------------------------
>
> def foo
> f = Proc.new { return "return from foo from inside Proc.new" }
> f.call # control leaves foo here
> return "return from foo"
> end
>
> def bar
> f = lambda { return "return from bar from inside lambda" }
> f.call # control does not leave bar here
> return "return from bar"
> end
>
> def baz
> f = proc { return "return from baz from inside proc" }
> f.call # control does not leave bar here in 1.8, but does in 1.9
> return "return from baz"
> end
>
> puts foo
> puts bar
> puts baz
>
> ----------------------------------------
>
> $ ruby blocks.rb
> return from foo from inside Proc.new
> return from bar
> return from baz
> $ ruby19 blocks.rb
> return from foo from inside Proc.new
> return from bar
> return from baz from inside proc
> $ macruby blocks.rb
> uncaught Objective-C/C++ exception...
> terminate called after throwing an instance of
> 'RoxorReturnFromBlockException*'
> Abort trap
>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
More information about the MacRuby-devel
mailing list