From: Peter Ertl Date: 2006-03-24T21:38:29+09:00 Subject: iterator class not working Hi, in order to understand ruby better (and for fun reasons of course) I try to write an iterator class. this way I want to understand 'binding' and 'callcc' better. however, it does not work! :-( any help will be greatly appreciated!!! --------------------------------------------- class Iterator def initialize(enum) @context = binding end def next enum = eval("enum", @context) @context, item = callcc do |cont| enum.each do |item| cont.call binding, item end end item end end names = %w{mary gordy john jane elwood} it = Iterator.new(names) 3.times do puts it.next end > mary > mary > mary Best regards Peter