From: "David A. Black" Date: 2008-10-18T04:45:18+09:00 Subject: [ruby-core:19369] Re: Yet another block semantic/syntax question Hi -- On Fri, 17 Oct 2008, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: [ruby-core:19343] Yet another block semantic/syntax question" > on Wed, 15 Oct 2008 23:03:20 +0900, "David A. Black" writes: > > |I just want to make sure I'm right that this is what happens, and that > |it's supposed to happen: > | > |>> pr = Proc.new {|a,b=1| p a, b } > |=> # > |>> pr.call(10,20) > |10 > |1 > |=> [10, 1] > > |In other words, Proc.new accepts the method-argument syntax, but does > |not use method-argument semantics (it sets b unconditionally to 1). > |(lambda uses method-arg semantics all the way in similar cases.) > > It's a bug. ;-< What is it supposed to do? Meaning: should Proc.new {|a,b=1| } behave like lambda, or should it be a syntax error (because it's using "yield semantics")? David -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails January 12-15 Fort Lauderdale, FL Advancing with Rails January 19-22 Fort Lauderdale, FL * * Co-taught with Patrick Ewing! See http://www.rubypal.com for details and updates!