[MacRuby-devel] RoxorReturnFromBlockException*
Rob Gleeson
rob at flowof.info
Thu Mar 31 00:07:25 PDT 2011
On 31 Mar 2011, at 08:05, Rob Gleeson wrote:
>
>
>>
>> def trigger_action(sender)
>> a_proc = Proc.new { |var|
>> puts "hello in proc"
>> return 1
>> }
>> a_proc.call('test')
>> puts "hello after proc"
>> end
>> That code runs without triggering an exception, and prints only "hello in proc" as expected. However, this variation on the code behaves differently:
>
> This shouldn't print "hello after proc". an explicit return should not return control to the caller within a method, it should return for that method.
> F. ex, 1 should be the return value of trigger_action.
>
> If it were a lambda, that behavior is expected (printing "hello after proc"), so I guess there's a bug somewhere.
>
> P.S: Gabriel, sorry, I replied to you directly instead of to the list :)
>
> - Rob
>
Oops, sorry Garbiel. I misread your post. "hello IN proc" is indeed printed and expected. :)
- Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20110331/16506217/attachment-0001.html>
More information about the MacRuby-devel
mailing list