Skip to content

Strongly typed Axis arguments #91

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

Closed
bluss opened this issue Feb 27, 2016 · 5 comments
Closed

Strongly typed Axis arguments #91

bluss opened this issue Feb 27, 2016 · 5 comments

Comments

@bluss
Copy link
Member

bluss commented Feb 27, 2016

We could have strongly typed Axis arguments (instead of current usize).

It even allows mixing dynamically bounds checked axis numbers and statically checked ones:

.subview(Axis(0), 1) vs. .subview(Axis0, 1) would both be possible at the same time.

@vbarrielle
Copy link
Contributor

Yes that's really a nice feature to have, imo it improves readability and prevents some mistakes. Axis0 would be exposed as a constant?

@bluss
Copy link
Member Author

bluss commented Feb 28, 2016

Yes. Using generics is unfortunate in one way, since it makes the interface seem more complicated. But it also enables static checking. I've tested this out at some point, and I think it works.

@bluss
Copy link
Member Author

bluss commented Feb 28, 2016

Oh I think it requires O(n²) impl blocks where n is the number of dimensions supported though (We have up to 12-tuples).

@vbarrielle
Copy link
Contributor

Maybe macros can help on that point, but I wouldn't know, I've not written many macros yet.

@bluss
Copy link
Member Author

bluss commented Feb 29, 2016

Fixed by #97

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

2 participants