relude
relude copied to clipboard
Start using named arguments for functions with ambiguous behavior
I would love to add more named args for things in Relude! Things that are a little ambiguous like Array.concat
where you aren’t totally sure which one is being placed first and which one is last. Something like Array.concat(~before, ~after)
or even Array.concat(~before, xs)
where one of the things is explicitly marked.
There are a lot of things across all of the modules that could benefit for using names args that would clarify what is going to happen.
I believe we had a naming convention for alternative named functions like concat
and concatNamed
so we could add more of those. I think other Reason libs used the convention concalLabelled
(Labeled
?), but I think we went with Named
.
Sorry, I edited, my comment, because I didn't fully read your initial proposal about just targeting the ambiguous ones first!
With a possible v2 release, it might make sense to change the API to make this just a thing that the library does everywhere when things are ambiguous and not have a separate function/module.
If we want to land on the case of not changing the API then I think sticking with Named
makes the most sense since that's what it currently is and in this case I'd rather be consistent.