Yep, no worries. I probably should have explicitly said that "hello after proc" doesn't print, which is the correct behavior.

-Gabriel

On Thu, Mar 31, 2011 at 12:07 AM, Rob Gleeson <rob@flowof.info> wrote:

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






_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel