On 9/4/20 1:48 AM, Jesse Phillips wrote:
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?

You are still missing the point ;)

Your example doesn't compile today. Mine does. It's not a question of which way is better, but that we already have code that depends on the chosen solution, and changing now means breaking all such existing code.

My point of bringing up the example is that your assertion that "it is already broken" isn't true.

To put it another way, if the above to!int call compiled, and we switched to exceptions, it would be the same problem, even if the right choice is to use Exceptions.

-Steve

Reply via email to