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

reduce duplicated code #263

Open
brody4hire opened this issue Sep 13, 2024 · 2 comments
Open

reduce duplicated code #263

brody4hire opened this issue Sep 13, 2024 · 2 comments

Comments

@brody4hire
Copy link
Contributor

While working on PR #260, I noticed what looks like quite a bit of duplicated code. I am wondering if we could find some kind of idiomatic way to make some generic structures & functions to help reduce the amount of duplicated code. I would love to take a look into this at some point.

@matklad
Copy link
Owner

matklad commented Oct 31, 2024

Perhaps we could reduce duplication indeed, but a hard requirement here is to also simplify the code along the way. Between duplication and more complex code, I would prefer duplication.

@briansmith
Copy link
Contributor

My experience with the race module was that I wanted to vendor OnceNonZeroUsize but not the rest of the file. I believe that OnceNonZeroUsize could be put into a separate submodule and then the rest of the file could be written in terms of its public API. Besides making vendoring parts easier, it would also better encapsulate the use of atomics by using a module boundary to hide the inner parts of OnceNonZeroUsize from the things that are built on top of 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

No branches or pull requests

3 participants