Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start using named arguments for functions with ambiguous behavior #325

Open
johnhaley81 opened this issue Jun 22, 2022 · 2 comments
Open

Comments

@johnhaley81
Copy link
Contributor

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.

@andywhite37
Copy link
Member

andywhite37 commented Jun 22, 2022

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!

@johnhaley81
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants