January 30, 2019
Is there any reason to use construct like `version (assert) if (empty) throw new RangeError();` intead of `onRangeError()` or just plain assert?
Worse, this causes @nogc to differ between release and debug.

See also: https://run.dlang.io/is/7h48fC

Thanks
January 30, 2019
On Wednesday, 30 January 2019 at 19:44:58 UTC, Ivan Butygin wrote:
> Is there any reason to use construct like `version (assert) if (empty) throw new RangeError();` intead of `onRangeError()` or just plain assert?
> Worse, this causes @nogc to differ between release and debug.
>
> See also: https://run.dlang.io/is/7h48fC
>
> Thanks

I would say, no. As if you want to assert, then, @nogc would ignore that, and if you release, the assert holds automatically.
If you want to throw, it would pass @nogc during debug, but resist during release compilation.

However, maybe I'm missing some relevant context...