Skip to main content
Ask A Question
You’re not receiving notifications from this thread.

Is there a good reason to not use keyword arguments always?

General • Asked by Rutul Dave

I have used keyword arguments for some of my methods before, but haven't really thought about why not use it for all methods with arguments?

Seems like there is no good reason to have the caller ever know the correct ordering for the arguments.

If verbosity of the code is the only issue with keyword arguments, is there a good reason to not use keyword arguments for all your methods?

More on keyword arguments from Thoughtbot -

I think its mostly just not taken off due to habit. We've had position arguments and then optional hashes which are pretty much keyword arguments so it's not a big change, but it's definitely a nice one.

It's probably a good habit to start using them where they make sense from now on. I'll probably just keep forgetting to do it though. :)

Login or Create An Account to join the conversation.

Subscribe to the newsletter


