DIP 1006 - Preliminary Review Round 1
Walter Bright
newshound2 at digitalmars.com
Tue Mar 6 10:17:42 UTC 2018
On 3/6/2018 1:58 AM, Jonathan M Davis wrote:
> [...]
The entire point of making assert a core language feature was so that the
compiler could take advantage of it to generate better code. It's been like that
for D since day 1. It has always been documented to do that. It has been
discussed many times in this n.g. over the years with loooong threads. I
designed it that way so that D could potentially produce better code than other
languages in ways they could not match.
There is no other purpose to making it a core language feature.
It's fine if you want an assert-like feature to have other semantics - just
define one called 'check', give it the semantics you want, and put it in the
library. As I mentioned to Timon, support for that sort of thing is why D has
special support for __LINE__ and __FILE__.
Or just don't turn off assert checking. Personally, I use asserts in a way that
they add little overhead so they can remain active in the release build.
It's entirely under your control.
More information about the Digitalmars-d
mailing list