Ruby: Proc.new { 'waffles' } vs. proc { 'waffles' }

后端 未结 1 1205
北恋
北恋 2020-12-14 00:17

In Ruby, are there any differences between Proc.new { \'waffles\' } and proc { \'waffles\' }? I have found very few mentions of the second syntax.<

相关标签:
1条回答
  • 2020-12-14 01:12

    From Metaprogamming Ruby Page 113.

    In Ruby 1.8, Kernel#proc() is actually a synonym for Kernel#lambda(). Because of loud protest from programmers, Ruby 1.9 made proc() a synonym for Proc.new() instead.

    0 讨论(0)
提交回复
热议问题