It would be better if shapes/dims and ranges were better differentiated. They are very similar, but differ in the following ways:
shapes/dims have strides, ranges do not.
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.
It would be better if shapes/dims and ranges were better differentiated. They are very similar, but differ in the following ways:
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 isarray 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, whiledim(index_t)
is interpreted as a dim with extent 1.This is a bit of a generalization of #12.