Hi,

2008/10/17 Yukihiro Matsumoto <matz / ruby-lang.org>:
> 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" <dblack / rubypal.com> 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 }
> |=> #<Proc:0x1ee114@(irb):10>
> |>>   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.  ;-<


Related to this:

$ ./ruby -e '
proc {|opt=:c, a1, a2, a3, a4, a5, a6, a7, a8, a9|
  p [a1, a2, a3, a4, a5, a6, a7, a8, a9]
}.call
'
-e:2:in `inspect': method `inspect' called on terminated object
(0x81c7408) (NotImplementedError)
        from -e:2:in `p'
        from -e:2:in `block in <main>'
        from -e:2:in `call'
        from -e:2:in `<main>'


vm_yield_setup_args in vm_insnhelper.c seems to assume that a proc object
has no post arguments and no optional ones.

-- 
Yusuke ENDOH <mame / tsg.ne.jp>