digitalmars.D - throw new RangeError() prevents algorithm.iteration from being nogc
- Ivan Butygin (6/6) Jan 30 2019 Is there any reason to use construct like `version (assert) if
- Alex (6/12) Jan 30 2019 I would say, no. As if you want to assert, then, @nogc would
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
Jan 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 ThanksI 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...
Jan 30 2019