On Friday, July 19, 2024 12:02:55 PM MDT H. S. Teoh via Digitalmars-d-learn
wrote:
> On Fri, Jul 19, 2024 at 05:48:37PM +, Dennis via Digitalmars-d-learn
wrote:
> > On Friday, 19 July 2024 at 17:20:22 UTC, matheus wrote:
> > > couldn't this case for example be caught during the compiling time
On Fri, Jul 19, 2024 at 05:48:37PM +, Dennis via Digitalmars-d-learn wrote:
> On Friday, 19 July 2024 at 17:20:22 UTC, matheus wrote:
> > couldn't this case for example be caught during the compiling time?
>
> The RangeError is only thrown when at runtime, the key doesn't exist,
> so that can'
On Friday, 19 July 2024 at 17:20:22 UTC, matheus wrote:
couldn't this case for example be caught during the compiling
time?
The RangeError is only thrown when at runtime, the key doesn't
exist, so that can't be caught. The real problem is implicit
slicing of static arrays, which I'm not a fan
On Friday, 19 July 2024 at 15:33:34 UTC, Dennis wrote:
On Friday, 19 July 2024 at 09:34:13 UTC, Lewis wrote:
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)?
The range `0 .. 3` has
On Friday, 19 July 2024 at 09:34:13 UTC, Lewis wrote:
```
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
On Friday, 19 July 2024 at 09:34:13 UTC, Lewis wrote:
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)?
The range `0 .. 3` has compile time known length, so it gets
converted to str
On Fri, Jul 19, 2024 at 09:34:13AM +, Lewis via Digitalmars-d-learn wrote:
> ```
> 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"] =
```
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