From: Robert Pankowecki Date: 2009-06-03T01:38:33+09:00 Subject: Proc in ruby 1.8.6 and 1.8.7 In Ruby 1.8.7 it is possible to do such thing: pr = Proc.new do |arg, &block| block.call end pr.call(123) do puts "xyz" end xyz => nil When calling proc another block can be given as parameter. Is there any way to do it in Ruby 1.8.6 ? Not working: irb(main):001:0> aba = Proc.new do |arg, &block| irb(main):002:1* end SyntaxError: compile error (irb):1: syntax error, unexpected tAMPER, expecting '|' aba = Proc.new do |arg, &block| ^ from (irb):2 == Not working: irb(main):003:0> pr = Proc.new do |arg, block| irb(main):004:1* block.call irb(main):005:1> end => # irb(main):006:0> pr.call(123) do puts "xyz" end NoMethodError: undefined method `call' for nil:NilClass from (irb):4 from (irb):6:in `call' from (irb):6 irb(main):007:0> == Working, but i want to avoid this solution: irb(main):007:0> pr.call 123, Proc.new{puts "xyz"} xyz => nil irb(main):008:0> I hope you people know some cool workaround. My application is currently running on Ruby 1.8.7 but i would like to use REE instead and right now this is the only issue that stops me from it. -- Posted via http://www.ruby-forum.com/.