Unexpected range assignment behaviour
Lewis
musicaljelly at gmail.com
Fri Jul 19 09:34:13 UTC 2024
```
string[3][string] lookup;
string[] dynArray = ["d", "e", "f"];
lookup["test"] = dynArray[0..$];
```
This fails at runtime with RangeError. But if I change that last
line to:
```
lookup["test"] = dynArray[0..3];
```
then it works. But the value of $ here is 3. Why do I get a
RangeError at runtime even though the slice is the correct size
(and the same size as the hardcoded one that works)? I would have
expected to only get a RangeError if at runtime the value turned
out to be wrong.
More information about the Digitalmars-d-learn
mailing list