>>>>> "C" == Csaba Henk <csaba / phony_for_avoiding_spam.org> writes:

C> lightweight closures used with yield. Now I wonder, what's the difference,
C> what is the addon that is provided with a proc object but is missing in case
C> of the "lightweight closures"?

svg% cat b.rb
#!/usr/bin/ruby
class Proc
   alias old_call call
   def call(*args)
      puts "new Proc#call"
      old_call(*args)
   end
end

def tt(&b)
   puts "==> Proc#call"
   b.call
   puts "==> yield"
   yield
end

tt { p 12 }
svg%
 
svg% b.rb
==> Proc#call
new Proc#call
12
==> yield
12
svg% 


Guy Decoux