On Thu, 28 Nov 2002 dblack / candle.superlink.net wrote:

[snip]
D> One thing I believe is missing, conceptually speaking, is the ability
D> on the part of a proc or code block to capture a reference to itself
D> from inside itself.
[snip]

is this not what this does?

[snip]
    def initialize_fetch_block
      @index = -1
      callcc do |@after_fetch|
	@has_next = true
	@enumerable.each do |@next_element|
	  callcc do |@next_fetch| @after_fetch.call end
	end
	@has_next = false
	@next_fetch = nil
	@after_fetch.call
      end
      @after_fetch = nil
    end

    def fetch_next_element
      result = @next_element
      @index = @index + 1
      callcc do |@after_fetch| @next_fetch.call end
      @after_fetch = nil
      result
    end
[snip]

@next_fetch and @after_fetch are referencess to blocks captured from inside
blocks?

-a

-- 

 ====================================
 | Ara Howard
 | NOAA Forecast Systems Laboratory
 | Information and Technology Services
 | Data Systems Group
 | R/FST 325 Broadway
 | Boulder, CO 80305-3328
 | Email: ahoward / fsl.noaa.gov
 | Phone:  303-497-7238
 | Fax:    303-497-7259
 ====================================