On Tuesday, 1 September 2020 at 18:55:20 UTC, Steven
Schveighoffer wrote:
On 9/1/20 2:20 PM, Jesse Phillips wrote:
Using RangeError is nice as it allows code to use array index
inside `nothrow.`
This is the big sticking point -- code that is nothrow would no
longer be able to use AAs. It makes the idea, unfortunately, a
non-starter.
What is wrong with using `in`? I use this mostly:
if(auto v = key in aa) { /* use v */ }
I think that actually might be my point. If you need nothrow then
this is what you need to do.
For breaking nothrow code using the [] syntax, I'd say it is
already broken because the behavior is to throw and the above is
how you would check that it won't.
The issue is, associative arrays throw an "uncatchable" error.
Meaning code is written to catch the error (because it works).
And correctly written `nothrow` code needs to use `in` to be
properly nothrow.