On Tuesday, 15 February 2022 at 22:02:13 UTC, Adam D Ruppe wrote:
On Tuesday, 15 February 2022 at 21:48:29 UTC, bachmeier wrote:
writeln(iota(v.length,-1,-1));
This would be like
for(a = v.length; a > cast(size_t) -1, a += -1)
That (cast(size_t) -1) is the same as thing.max, meaning a will
never be greater than it.
Why does the first argument to iota have to be an int, and why
isn't there an error message when I pass something else?
Yeah, perhaps when you give it that -1 as the second argument
it should see it is signed and throw something.
After looking at the documentation and seeing CommonType!(int,
uint) is uint, I have to say that iota's behavior doesn't make
much sense.