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

Better differentiate between ranges and shapes #23

Open
dsharlet opened this issue Jul 5, 2020 · 0 comments
Open

Better differentiate between ranges and shapes #23

dsharlet opened this issue Jul 5, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@dsharlet
Copy link
Owner

dsharlet commented Jul 5, 2020

It would be better if shapes/dims and ranges were better differentiated. They are very similar, but differ in the following ways:

  1. shapes/dims have strides, ranges do not.
  2. Typically, one cares more about the min of a range, and the extent of a dim.

A common pattern, e.g. a(b.x(), b.y()), but it's passing the stride of x and y to b's operator(). It doesn't cause problems, but it is messy. A worse example is array b(a.shape()): If b has padding (e.g. if it were the result of a crop), it allocates b with the same padding, which is a surprising behavior.

The second issue manifests in a current ugly minor issue: range(index_t x) is interpreted as a range with a min of x and extent 1, while dim(index_t) is interpreted as a dim with extent 1.

This is a bit of a generalization of #12.

@dsharlet dsharlet added the enhancement New feature or request label Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant