```"Eric Hodel" <drbrain / segment7.net> schrieb im Newsbeitrag
news:20030220231342.GH73411 / segment7.net...

> Robert (bob.news / gmx.net) wrote:
>
> > irb(main):144:0> procs = [
> > irb(main):145:1*   Proc.new{|a| p a},
> > irb(main):146:1*   Proc.new{|*a| p a},
> > irb(main):147:1*   Proc.new{|a,| p a},
> > irb(main):148:1*   Proc.new{|a,b| p a}
> > irb(main):149:1> ]
> >
> > 1) Why is it that "proc[0].arity = -1"?  Or put differently: To me it
seems
> > there is an asymmetry between proc[0].arity = proc[1].arity and the
behavior
> > of proc[0] that resembles more p[2].  If "proc[0].arity = 1" I would be
> > fine, but -1 puzzles me...
>
> -1 means 0 or more args, -2 means 1 or more args, etc

I know that, sorry if I wasn't clear enough. What bugs me is the fact that
the block with a single argument has negative arity, indicating that there
can be more arguments. Why then doesn't the block with two arguments have
arity -2, too?  Or otherwise, why doesn't the block with |a| have arity 1?

> > 2) Why does this parse "Proc.new{|a,| p a}"? (the comma with following
bar)
>
> the |...| construct is pretty much the same as multiple assignment with,
>
> a,b,c = [1,2,3]
>
> a, = [:a, :b, :c]

It just seemed strange to me that you can have a comma here but no
following enumerated element - especially since a block definition with
|a,| behaves differently from the one with |a|.

Regards

robert

```