From: Hugh Sasse Staff Elec Eng Date: 2000-08-08T09:32:51+01:00 Subject: [ruby-talk:04338] Re: TABWTDI and Hash.new([]) On Tue, 8 Aug 2000, ts wrote: > >>>>> "H" == Hugh Sasse Staff Elec Eng writes: > > H> That is even clearer. I wonder why you didn't put > H> def initialize(&block) > H> @a = [] > H> @obj = block > H> end > H> before, then? > > When I see in a script > > def a(&block) > end > > I *really* read : > > def a > block = nil > if iterator? > block = Proc.new > end > end So when you wrote that function before, you had already expanded it in your head beforehand, so the short form never made it into the file. Is that what you mean here? > > H> Did I miss something? > > I must try to forget the source of ruby > > > case NODE_BLOCK_ARG: > if (ruby_scope->local_vars == 0) > rb_bug("unexpected block argument"); > if (rb_iterator_p()) { > result = rb_f_lambda(); > ruby_scope->local_vars[node->nd_cnt] = result; > } > else { > result = Qnil; > } > break; > > I have not delved into the source yet, so I don't see how this piece fits into the discussion here :-) > > Guy Decoux > > Hugh