On Thursday, 10 January 2013 at 14:31:04 UTC, monarch_dodra wrote:
On Thursday, 10 January 2013 at 14:28:44 UTC, bearophile wrote:
monarch_dodra:
After:
//----
auto opSlice(size_t i, size_t j)
{
version(assert)
if (i > j)
throw new RangeError();
}
But now opSlice can't be nothrow, nor transitively all the
code that calls that :-(
Bye,
bearophile
It can because RangeError is an *Error*.
Apologies again, if my answer was not clear: Nothrow means the
function can't throw *exceptions*, but errors are fair game.
For example, this compiles:
//----
import core.exception;
void foo() nothrow
{
throw new RangeError();
}
void main()
{
foo();
}
//----