News for hackers. Stuff that matters.
Re:JavaScript Needs Blocks by wycats on Tuesday January 10, 2012 @02:52PM (#3448669)
Nah. Ruby just raises an exception in this case:

  class BlockInvoker
    def initialize(&block)
      @block = block
    end

    def invoke
      @block.call
    end
  end

  BlockInvoker.new { puts 1 }.invoke

  def get_block_invoker
    BlockInvoker.new { return }
  end

  get_block_invoker.invoke
I tried to cover this a bit in my post. For callbacks, this semantic is clunkier.

There are no comments on this comment yet.