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

Make Sectors, Bytes, Metablocks have private inner value #399

Open
mulkieran opened this issue Jan 3, 2019 · 3 comments
Open

Make Sectors, Bytes, Metablocks have private inner value #399

mulkieran opened this issue Jan 3, 2019 · 3 comments

Comments

@mulkieran
Copy link
Member

We can use newly available const fn designation to define new methods for all these types. These methods, since const can be used in the definition of constants. With inner value non-public it can not be accessed, which would require all necessary arithmetic methods to be defined in the impls of these types. (stratisd cheats in a few places by dereferencing the inner value and using raw arithmetic where the operation desired is not available.)

@mulkieran
Copy link
Member Author

Related: #377.

@mulkieran
Copy link
Member Author

I did a little experiment with this, but it seems that macro_attr generates a hidden and unusable new. Somehow, when I add a new function, there is a conflict with a previous definition.

@mulkieran
Copy link
Member Author

mulkieran commented Feb 14, 2019

We should consider dropping our dependence on macro_attr entirely. It can only provide, correctly, a subset of the operations we want, so the rest must be made by hand anyway. If all were made by hand, the structure would possibly be simpler. We would also get rid of the dependency on newtype_derive which was probably a mistake in the first place.

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