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

Handle Struct Arguments Consistently #638

Open
kyleboe opened this issue Oct 25, 2024 · 0 comments
Open

Handle Struct Arguments Consistently #638

kyleboe opened this issue Oct 25, 2024 · 0 comments

Comments

@kyleboe
Copy link
Contributor

kyleboe commented Oct 25, 2024

In many cases, we want to accept either a struct or an id as an argument to an function. I'm curious if there is a sane, reusable pattern that can be used instead of inconsistent usage of function clauses.

For example, passing the Message struct as the first argument to message-related API calls sometimes pattern matches the relevant keys off of the struct (id and channel_id) and in other times, there is no function clause available.

This may be not worth the amount of complexity needed to abstract this kind of functionality, but we can discuss below.

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

1 participant