From: Hugh Sasse Staff Elec Eng Date: 2000-08-08T09:11:31+01:00 Subject: [ruby-talk:04335] Re: TABWTDI and Hash.new([]) On Tue, 8 Aug 2000, ts wrote: > >>>>> "H" == Hugh Sasse Staff Elec Eng writes: > > I must say that : > > H> def initialize(some_arg = nil) > H> @a = if some_arg > H> some_arg > H> else > H> [] > H> end > H> @obj = if iterator? > H> Proc.new > H> else > H> nil > H> end > H> end > > is really equivalent to : > > def initialize(some_arg = [], &block) > @a = some_arg > @obj = block > end > That is even clearer. I wonder why you didn't put def initialize(&block) @a = [] @obj = block end before, then? Did I miss something? > > > Guy Decoux > > Hugh hgs@dmu.ac.uk