[MacRuby-devel] RoxorReturnFromBlockException
Mike Moore
blowmage at gmail.com
Thu Oct 29 23:16:26 PDT 2009
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20091030/7e5f6a30/attachment-0001.html>
More information about the MacRuby-devel
mailing list