On Wednesday, 29 December 2021 at 01:11:13 UTC, Stanislav Blinov wrote:

Because opIndexAssign cannot distinguish at compile time between initialization and assignment:

```d
Stuff[Key] aa;
aa[key] = Stuff(args); // ostensibly, initialization
aa[key] = otherStuff;  // assignment to existing value
```

Same syntax, different behavior. This can only be caught at runtime. `require` and `update` though should be able to pull this off, and that they don't is a bug.

Of course but opIndexAssign() isn't there in my example. The compiler should call runtime's _aaGetY() or something like that directly.


Reply via email to