So, I can acheive what I want with named functions: but I thought it would be nice to be able to use the range ‘operator’ to pair coordinates to represent a rectangular/cuboid etc region, for multi-dimensional arrays e.g.
my3darray[min..max] // a 3d cuboid slice imagine being able to instigate block copies etc like that.
if I’ve understood right, the protocol quite allow it (because to actually iterate, it’s going to actually step the ‘start’ value… it’s expecting ‘T’ to support partial ord etc… “…” is more like a constructor for a simple struct than an ‘operator’ returning an iterator as such ?)
I realise first off there’s ambiguity… do you mean a line or an axial region: however, seeing it in array syntax I’d claim it suits an ND region
I suppose there’s the contrasting idea of having a
Vec3<Range<i32>> eg Vec3(min.x…max.x, min.y…max.y, min.z…max.z) but as you can guess what appealed to me was being able refer to it concisely etc
is this idea just stretching the syntax too far, or has anyone else wanted to do this… are there options i’ve missed.
the appeal of the operator over named functions is there’s naming to (dis)agree on … it’s very guessable once you’ve seen it on the primitives
I know rust also has tuples which can make using pairs easy, they’re an ok option too