Issue #11605 has been updated by Rodrigo Rosenfeld Rosas.


Oh, thanks. I had no idea on how to try this. I've tried a(, 'required'). Actually, I was reading a method like a(req1, opt='opt', req2) and thought it would be impossible to use the default value, but now I understand how optional arguments work in Ruby. Sorry for the confusion.

----------------------------------------
Feature #11605: Ruby should raise on def(a='a', b) [optional param that can't be used]
https://bugs.ruby-lang.org/issues/11605#change-54485

* Author: Rodrigo Rosenfeld Rosas
* Status: Rejected
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
Why doesn't Ruby complain when defining a method like this?

~~~
def a(opt='opt', required)
end
~~~

I believe it's impossible to call method 'a' passing only required, while sticking to the default value for 'opt', right? So, why should Ruby allow such definition?



-- 
https://bugs.ruby-lang.org/