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

refactor: revert #107 but using enum_dispatch #117

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bxb100
Copy link
Contributor

@bxb100 bxb100 commented Nov 25, 2024

hi, @j178 , IMHO I think using enum_dispatch to remove boilerplate code much better, PTAL

@j178
Copy link
Owner

j178 commented Nov 27, 2024

Thanks for letting me know about enum_dispatch. Before #107 (and in this PR), we had to perform two matches: first from config::Language to languages::Language, and then from languages::Language.<some method> to the actual function implementation. After #107, we only need to perform one match.

There is some boilerplate code, but it seems manageable. We could write a macro to reduce the boilerplate code into a single location. What are your thoughts on this?

@bxb100
Copy link
Contributor Author

bxb100 commented Nov 27, 2024

understand, my initial motivation was to eliminate static, if you want to keep this, I'm fine with it

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

Successfully merging this pull request may close these issues.

2 participants