I think Associative Array should throw Exception
Jesse Phillips
Jesse.K.Phillips+D at gmail.com
Fri Sep 4 05:48:30 UTC 2020
On Thursday, 3 September 2020 at 15:12:14 UTC, Steven
Schveighoffer wrote:
> int[int] aa;
> aa[4] = 5;
> auto b = aa[4];
>
> How is this code broken? It's valid, will never throw, and
> there's no reason that we should break it by adding an
> exception into the mix.
>
int foo() nothrow {
return "1".to!int;
}
The following code is valid, will never throw, why does the
compiler prevent it?
More information about the Digitalmars-d-learn
mailing list