I often want to extract a mandatory value from an options keyword list, and continue treating the rest as less strict configuration.
This is a two-liner: mandatory = Keyword.fetch!(options, :mandatory); optional = Keyword.delete(options, :mandatory)
I do this just often enough, I'd like to propose {mandatory, optional} = Keyword.pop!(options, :mandatory)
- It fits in well with the current Map API
- It's simple to implement and maintain
- It provides an analog for the keyword variant of the (non-existent) positional def foo(mandatory, *optional)
However it merely replaces a trivial two-liner, so this comes down to others in core finding the idiom common enough to merit widening the Map API surface area. I do, hence the proposal, but I'd love to hear other's experiences.