Project

General

Profile

Misc #19971

Updated by andrykonchin (Andrew Konchin) 12 months ago

I've noticed that such proc `proc { |a,| }` has arity `1`: 

 ```ruby 
 proc { |a,| }.arity # => 1 
 ``` 

 `1` that means only one 1 required parameter, but the proc behaves similar to like there is a proc with explicit rest parameter (`proc { |a, *| }`) that has arity `-2`: 


 ```ruby 
 proc { |a, *| }.arity # => -2 
 ``` 

 that `-2` (that means one 1 required parameter and + rest parameter. parameter). 

 So I am wondering whether it's intentional behaviour and what the rational is behind it.

Back