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

Add a diman_lib crate #68

Closed
Tehforsch opened this issue Jan 12, 2024 · 0 comments · Fixed by #70
Closed

Add a diman_lib crate #68

Tehforsch opened this issue Jan 12, 2024 · 0 comments · Fixed by #70

Comments

@Tehforsch
Copy link
Owner

Certain types such as the Ratio type which is used for dimensions if rational dimensions are enabled and in the near future the type containing magnitudes (a const float type of thing) are needed by both diman_unit_system (to compute dimensions while parsing the macro) and by the calling crate (for the const generics).
Now, there is no way to export them from diman_unit_system because it's a proc_macro crate and not allowed to export any non-proc_macros. They also can't be exported from diman because that would introduce a cyclic dependency.

I think adding a diman_lib that contains this shared functionality is useful.

  1. It solves the problem with duplicate code.
  2. Less code generated by the macro probably means slightly better compile behavior when the user uses their own custom unit_system and changes something in it.
  3. It doesnt require writing the code in the macro itself which is always a bit more bug-prone and just unfun in general.
@Tehforsch Tehforsch linked a pull request Jan 13, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant