3 ms·
This might be me having huffed too many types lately, but I feel like I would want that to break.
by Klonoar 3y ago
This might be me having huffed too many types lately, but I feel like I would want that to break.
- mcv 3y agoAdding a parameter that has a sensible default value? I don't think I'd want that to break anything.
- Klonoar 3y agoThe inverse here - specifying {} directly - does not at a glance imply a default value is being constructed. (Or perhaps it does and this is just some Ruby-ism I'm not exposed to)
- andolanra 3y agoThat's kind of the point of default values, though. If you wanted to make a change to the method and you want it to break to alert you to all the calls, then you can add a keyword without adding a default value for it. def foo(kwargs = {}, frob:) kwargs end