>>>>> "S" == Simon Strandgaard <neoneye / adslhome.dk> writes:

S> On Mon, 19 Apr 2004 20:23:20 +0900, Dan Doel wrote:
>> I must admit, I don't understand what you're doing exactly either...
>> 
>> How is your code different from:
>> 
>> def mode2(&blk)
>> mode(&blk)
>> end
>> 

S> My code can take an optional block. Your above code
S> must be supplied a block.

 What do you call an optional block ?

svg% cat b.rb
#!/usr/bin/ruby
class ModeInfo
   def initialize; @tabsize = 8 end
   def tabsize(value); @tabsize = value end
end

def mode(&block)
   m = ModeInfo.new
   m.instance_eval(&block)
   p m
end

def mode2
   mode(&Proc.new)
end

mode2
svg% 

svg% b.rb
./b.rb:14:in `new': tried to create Proc object without a block (ArgumentError)
        from ./b.rb:14:in `mode2'
        from ./b.rb:17
svg% 



Guy Decoux