New 2.7/3.0 keyword argument pain point

Hi there, speaking from the perspective of RSpec, the main pain point for our library is that we transparently pass around arguments given by users, to user code, so we are not directly aware (in a lot of cases) wether keyword arguments are being used or not, we can refactor our code to mitigate this, and we currently plan to for the next major version, but the current keyword argument splat is not parsable on older Rubies (which we must support until our next major version due to our interpretation of semantic versioning).

The current plan, for real keyword arguments in Ruby 3, realistically means we will need to have that new major version ready before the release, and only support Ruby 3 in that version, but for now we must implement arcane workarounds to detect and call keyword arguments separately to remove this warning.

A pragma flag to indicate old / new keyword argument behaviour, would work for us as a workaround, so would having a more permissive ruby2_keywords behaviour where we simply mark methods as treating arguments as a splat and passing it on. Similarly, a new api to allow us to take a arg splat and produce args / keywords would allow us to have back compatibility with much less pain.

Overall I’m a fan of having real keywords, its just a painful transition considering the long history of soft keywords.

4 Likes