Hacker News new | past | comments | ask | show | jobs | submit login

The 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)




That'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




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: